Making a web part part 2 – adding XML pages

All three must be added in the project to the folder beneath 12/Template/FEATURES/WEBPARTNAMEFOLDER/

Add feature.xml

<?xml version=”1.0″ encoding=”utf-8″?>
<FeatureĀ  Id=”A GUID”
Title=”… ”
Description=”….”
Version=”1.0.0.0″
Hidden=”FALSE”
Scope=”Site”
DefaultResourceFile=”core”
xmlns=”http://schemas.microsoft.com/sharepoint/”>
<ElementManifests>
<ElementManifest Location=”elements.xml”/>
<ElementFile Location=”WEBPARRTNAME.webpart” />
</ElementManifests>
</Feature>

Add elements.xml

<?xml version=”1.0″ encoding=”utf-8″ ?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>
<Module Name=”WebPartPopulation” Url=”_catalogs/wp” RootWebOnly=”TRUE”>
<File Url=”WEBPARRTNAME.webpart” Type=”GhostableInLibrary”>
<Property Name=”Group” Value=”GROUP NAME”></Property>
<Property Name=”QuickAddGroups” Value=”GROUP NAME” />
</File>
</Module>
</Elements>

Add WEBPARRTNAME.webpart

<?xml version=”1.0″ encoding=”utf-8″ ?>
<webParts>
<webPart xmlns=”http://schemas.microsoft.com/WebPart/v3″>
<metaData>
<type name=”NAMESPACE.CLASSNAME, NAMESPACE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=faa3e7595fe32ea9″ />
<importErrorMessage>Cannot import webpart.</importErrorMessage>
</metaData>
<data>
<properties>
<property name=”Title” type=”string”>TITLE OF WEBPART</property>
<property name=”Description” type=”string”>Rollup details for all entities.</property>
</properties>
</data>
</webPart>
</webParts>

Comments are closed.