I have requirement to add Client Web Part to .aspx page programmatically in SharePoint provider hosted app, I have tried this link, but this is for SharePoint hosted app, below code is not working for provider hosted app page because of restriction of server side tags,

 <asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
 <asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" runat="server">
 <WebPartPages:WebPartZone runat="server" AllowPersonalization="true" ID="WebPartZone2" FrameType="TitleBarOnly" Title="Bottom" Orientation="Vertical">
        <WebPartPages:ClientWebPart runat="server"
             Title="My WebPart Title"
             Description="WebPart Description"
                <WebPartPages:ClientWebPartProperty Name="myIntProp" Value="7"></WebPartPages:ClientWebPartProperty>
                <WebPartPages:ClientWebPartProperty Name="myEnumProp" Value="EnumValue1"></WebPartPages:ClientWebPartProperty>

Is there any alternative way to achieve the same?

  • What is wrong with this approach? Another way is to use CSOM to add the web part, it is quite easy
    – eirikb
    Commented Mar 28, 2014 at 8:28

2 Answers 2


I followed this blogpost: http://www.vrdmn.com/2013/03/sharepoint-2013-declaratively-add-app.html

The only modification I did was that I had to find the FeatureId by powershell:

Get-SPFeature -web <url to your site> | select DisplayName, Id

One of the features has a DisplayName and ID that is a guid almost identical to the ProductId. In my case, only the last character differed. This features guid is the id for the FeatureId property.

It is pretty strange that it seems impossible to find the FeatureId without first installing the app and then check for the id through powershell, but I haven't found any other way yet.

  • That PowerShell will not work in SharePoint Online.
    – wjervis
    Commented Aug 15, 2014 at 11:36

Add client app part to sharepoint site page. open site page in sharepoint designer. It will show you feature id ,product id and all other details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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