Quantcast
Channel: Vardhaman Deshpande
Viewing all articles
Browse latest Browse all 134

SharePoint 2013: Provision AppPart/ClientWebPart through Elements.xml

$
0
0
In my last post, we saw how we can add an app part to page by directly adding the app part code in our .aspx pages. Here is a link to my last post for those interested: http://vrdmn.blogspot.in/2013/02/sharepoint-2013provision.html

Now lets take a look at how we can provision the app part declaratively through Elements.xml file. First, you will have to make sure that the App is installed on the site on which you are trying to deploy the app part. Otherwise your app part will not be provisioned correctly.

Here is the code to put in your Elements.xml file:



Keep in mind the following few properties:

ProductId: Its the ProductId of your App. A unique identifier which differentiates your app. Please see my last post on how you can get the ProductId of your App.


FeatureId: The same as ProductId. On first glance, it looks like it should be the GUID of the feature present in your app. But thats not the case as far as I know.


ProductWebId: A new Random GUID


WebPartName: The file name of the WebPart found in your Client WebPart XML file. See previous post for  more details.


Custom Properties: You can even provision custom properties and set their default values from here. In the example, I have the myEnumProp as a custom property in my App Part. Here is a link on how to add custom web part properties to your app part: 

http://msdn.microsoft.com/en-in/library/fp179921.aspx




Viewing all articles
Browse latest Browse all 134

Trending Articles