0

I have a classic SharePoint site hosted on SharePoint online.
I edit the Home Page and try to insert a Web Part but there isn't it listed!

enter image description here

In Visual Studio I have created a SharePoint hosted Add-in project, with all the logic that I want to be displayed to the user coded inside the Default.aspx page.

(I have read several times the Microsoft example - Create add-in parts to install with your SharePoint Add-in, but as it is related to Provider hosted add-in and I haven't been able to re-adapt it to my case).

In the Visual Studio solution I have added a ClientWebPart and I have pointed it to the Default.aspx page:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ClientWebPart Name="VerbaliAddInPart" Title="VerbaliAddInPart" Description="VerbaliAddInPart Description" DefaultWidth="400" DefaultHeight="500">
    <Content Type="html" Src="~appWebUrl/Pages/Default.aspx?{StandardTokens}" />
    <Properties>
    </Properties>
  </ClientWebPart>
</Elements>

I think the problem could be that I have a wrong value for Start Page inside the AppManifest.xml.
(Actually it is the default value which is VerbaliDiCollaudo/Pages/Default.aspx).

How should I set the Start Page value?

Or maybe there isn't another problem?

0

If you are not using a dev site, You need to publish the app on an appcatalog.

  • Yes, good point, I missed to mention it. I have installed it on the app catalog, located at: https://mycompany.sharepoint.com/sites/apps/AppCatalog/. Then, in my site I have installed it: Site contents-->Add an app and Trusted it. After that I am able to launch it "directly" but I also would like to insert it inside my site Home Page. – spiderman Oct 16 '18 at 10:28
  • Go to AppManifest, and change the startpage to DefaultPage. – Alec Lawrence Tecson Oct 17 '18 at 11:13
0

Maybe I have found how to solve the problem, but not the explanation!

If I point to the Default.aspx page, the Add-in is not displayed.

Default.aspx code is like this:

<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%-- The markup and script in the following Content element will be placed in the <head> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <script type="text/javascript" src="../Scripts/jquery-1.9.1.min.js"></script>

Instead if I add a new AppPartContent.aspx with code like this:

<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<WebPartPages:AllowFraming ID="AllowFraming1" runat="server" />
<!-- Placeholder for edit mode message -->
<h1 id="editmodehdr" style="display:none">
    The app part is in edit mode.
</h1>

and make the Add-In src point to AppPartContent.aspx I can add it!

Add-in is displayed in Edit page

Why can't I use Default.aspx page as my Add-in content?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.