Thursday 14 February 2013

SharePoint 2013: Provision AppPart/ClientWebPart to Page

Along with Apps, SharePoint 2013 has introduced App Parts (ClientWebParts) which give you the functionality of placing the app inside and iframe on a page. This way, you can view your app as a part of the page just like you would a normal webpart.

(The terms App Part and Client Web Part are interchangeable. I will be using both the terms in this post to emphasize the similarity)

Adding an App Part to the page from the SharePoint User Interface is pretty easy. You just put the page in edit mode and add the AppPart from the Insert Menu. Pretty similar to how you would add a regular WebPart.

Now what if you have to provision your AppPart in a Page or a PageLayout so that when a new page is created with a feature, your AppPart is automatically placed on that page?.

If you want to know how to add an app part to a page declaratively through the Elements.xml file, please have a look at my post here:

Lets look at how it can be done:

First and foremost, you will need to create an AppPart (Client WebPart) for your app. Here is a great tutorial on it:

Your Client WebPart xml file should be similar to this:

Here, I have created a Client Web Part with 2 Properties of type int and enum respectively.

Second, you have to make sure that your app is already installed on the Web on which you will be provisioning your page. The AppPart will only work if the app is installed on the same web.

Next, you will need the ProductId of your app. Here is how to find it:

1) Open your app in Visual Studio -> Right Click on the AppManifest.xml -> View Code

2) Here you will find the ProductId of your app in the following location:

3) Save your ProductId in a convenient location.

4) Now open your Page or Page Layout and add the following code to it:

In FeatureId, enter the ProductId which we got from the app earlier.

In ProductWebId, create a new random GUID and add it. 

You can even set default values for the App Part Properties.

5) That's It, Now deploy your page and see that the App Part is Provisioned on the Page.


Sean O’Leary said...

Since app integration has become more of a focus with SharePoint 2013 this is an important feature. Many apps have been created that will make the process that much easier.

Anonymous said...

Could you please specify how to setup existing App Part properties from the Elements.xml file. For example: How to setup the Chrome Type property to be "None" instead of "Default" which is the default value.

Vardhaman Deshpande said...

Sure. Take a look at my next Post here:

Anonymous said...

Hi Vardhaman
Can i do it in SharePoint online 2013?
if yes, Let me know how please?
I can use the sandbox solution to deploy the page, but Microsoft deprecate using this solution in SharePoint 2013.

Thanks for advance.

Vardhaman Deshpande said...

Hi Fouad,

Yes you can do this in SharePoint Online 2013 too. Microsoft has deprecated code inside sandbox solutions but we can still provision lists, pages, webparts etc. declaratively through them. You can have a look at my other post to see how you can deploy an app part to page using the Elements.xml file in a sandbox solution.

Anonymous said...

Thanks for the post. Ver informative; however, I am encountering some issue. I used both of your approach too add a client web part to my page but I keep getting this error: "MyWebPart ClientWebPart feature 6c1ca245-6868-43a3-968c-5914a76159c8 is not installed or is not Active."

My solution is a autohosted app but the page I am adding as webpart both live in the app web.

Anonymous said...

Hi Vardhaman,

can you please tell me how to do this for out-of-the-box app parts? I want to provision the app part for a promoted links list. Thanks

Vardhaman Deshpande said...

Hi Anonymous,

What you can do is, you can add the app part to the page manually. And then see the source of that page through SharePoint designer. You will get all the necessary IDs which you can include in your solution.

Tolga Yaramış said...


It works and I could add my app as webpart in a pagelayout. If I open a page which uses this pagelayout, the app is displayed in the page.

However, the problem that I have is, if I open the page in edit mode, the web part properties dialog is not available. That's why I could not personalize the webpart.(AllowPersonalization="True")

What should I do to enable web part properties?

Thanks in advance.

Unknown said...

Hi, I have the exact same problem as Tolga. Anybody found a solution?

Unknown said...

How would you go about setting the (host) url of the current page in one of the properties?

I am using this inside of a master page, so really confused about it.

We had to make the following changes for you sample to work on the master page:

I need Value to be the current host page url.
I already tried these two options:

However, the first version just comes up with the text "javascript:window.location.href", which makes me think 9it is being evaluated on the server, so switched to the second option, which keeps giving me errors when loading any page with the master page.

Any idea/help/feedback would be welcome

Deepak Chauhan said...

The Publisher of SP.UserProfile.js couldn't be verified are you sure you want to run the program

above Error shows when we open the above js file in brower so the property and PictureUrl undefined

Reply !!

Unknown said...

Hi Vardhaman Deshpande,

Nice Article. My Problem is I want replace New ProductID in place of Existing ProductID and I want change version. May I possible to change ProductID and Version in AppManifest.xml. Please help if you know the process. Thank you for Advance.

Jayaseelan said...

Hi Tolga,

i am facing same issue given below,
"The MyWebPart ClientWebPart feature b8344d09-7cc0-4f72-a8c3-8f02129d7633 is not installed or is not Active".

can you please tell me what are the ids needs to be changed?


Jayaseelan said...

Hi Tolga,

I am facing the same issue,
"The MyWebPart ClientWebPart feature b8344d09-7cc0-4f72-a8c3-8f02129d7633 is not installed or is not Active".

Can you please tell me what are the ids needs to be changed?.

Jayaseelan said...

I added web part id ID="g_499aa355_6bba_483d_91bc_6aa7f7726274" as it was in client web part. its working now.

Jayaseelan said...

I added web part id ID="g_499aa355_6bba_483d_91bc_6aa7f7726274" as it was in client web part. its working now.

Unknown said...

Hi Vardhaman,

Thanks for the valuable post. Am getting below error after i added the client app part in page.
"Feature is not installed or is not Active in sharepoint"

It would be very helpful if you give soltution to this problem,

Guillaume Oudill said...


Good post! This is exactly what I'm looking for. I'm currently trying to add an AppPart in a page layout.

When changing the page layout, I get this error: The MyAppPart ClientWebPart feature 3fbaae91-f4f8-402f-ac5b-0e4b60fc1283 is not installed or is not Active.

Any idea ?
Thanks for your help !

Vardhaman Deshpande said...

Hi Guillaume,

You need to have the App installed on the web where you are trying to provision the app to the page.

I know it's not a perfect process in terms of provisioning. Maybe you can look into Side Loading the App as part of your provisioning process.

TP said...

Hi Vardhaman,

I've got the same issue as above. I've found that app feature ID is different that it was specified in AppManifest.xml file (last character is different).

Do you have any idea why this ID changes?

aw said...

To resolve "feature xxx is not active or not installed", I made sure Enable app SideLoading feature is turned off when I embed my client web part onto the page. (on the condition that the app is already installed in the site contents)