Tuesday, September 11, 2012
Site Provisioning : Webpart and Webpages
Different ways to provisioning webpart
===========================
There are many ways to add a webpart on a page like Web part can be provisioned using feature receiver(Using SP object model), webpart can be provisioned using different xml markups in ONET.xml. Here i want to describe few of the xml markup techniques to do the same.
1. Using AllUserView webpart
- Sample is as below
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="3>
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
<Title>My Test Documents</Title>
<Description>TestDocuments</Description>
<FrameType>Standard</FrameType>
<IsVisible>true</IsVisible>
</WebPart>
]]>
</AllUsersWebPart>
2. By creating LVWP using VIew element.
- Few of the approaches to do the same.
- Samples are as below A. and B.
A.
<View List="Lists/TestDocuments" BaseViewID="1" WebPartZoneID="Left" WebPartOrder="3" />
B. With properties
<View List="Lists/TeamDocuments" BaseViewID="1" WebPartZoneID="Left" WebPartOrder="5">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="AllowConnect" type="bool">False</property>
<property name="ChromeType" type="chrometype">TitleAndBorder</property>
</properties>
</data>
</webPart>
</webParts>
]]>
</View>
C.
<View List="Lists/TestDocuments" BaseViewID="1" DisplayName="TestDocuments" Name="TestDocuments" RecurrenceRowset="TRUE" WebPartZoneID="Left" WebPartOrder="3">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
<Title>Test Documents</Title>
</WebPart>
]]>
</View>
3. By using Binary Serialized Webpart -
Here is the steps for How to provision Binary Serialized Webpart
- Create a webpart page and Save the page into page/document library. Add webparts to the page.
- Save site as a template (NOTE - Do NOT include content while saving the site as template.)
- Download and Rename WSP file to CAB file and extract it
- Go to modules folder and fetch the module xml.
- Use the same module xml to create element xml while create module in Visual studio solution.
Thanks to - http://blogs.edwardwilde.com/tag/onet-xml/
Subscribe to:
Post Comments (Atom)
1 comment:
Hello, very professional high level blog! thank you for sharing. Because of good writing, and I learned a lot, and I am glad to see such a beautiful thing. Sorry for my bad English. ?
Post a Comment