Declarative view tags for SharePoint 2010 branding

1.Add a list to the SharePoint project using the tools in Visual Studio.

2. Deploy the lists.

3. In the SharePoint site that you deployed to, build views with correct columns, limits, filtering, and grouping, and sorting.

4. Save the list as an .stp file.

5. Next, you will save the .stp file to your hard drive, change the file extension to .cab, and extract the manifest file.

6. Open the manifest.xml in Internet Explorer so you can see the XML node hierarchy easily.

7. Get following tags, paste into Notepad, clean out unneccessary special characters such as hyphens.

Example tags:

<Query>
<OrderBy>
<FieldRef Name=”Modified” Ascending=”FALSE”/>
</OrderBy>
<Where>
<Eq>
<FieldRef Name=”colShowHomePage”/>
<Value Type=”Boolean”>1</Value>
</Eq>
</Where>
</Query>
<Aggregations Value=”Off”/>
<RowLimit>10</RowLimit>
<Mobile MobileSimpleViewField=”colCustomLink” MobileItemLimit=”3″/>

<Toolbar Type=”Standard” /><XslLink Default=”TRUE”>main.xsl</XslLink>

replace this:
<Query /><Toolbar Type=”Standard” /><XslLink Default=”TRUE”>main.xsl</XslLink>

In Visual Studio, in the list definition files, find the <Query> tag.

Replace this:
<Query /><Toolbar Type=”Standard” /><XslLink Default=”TRUE”>main.xsl</XslLink>

With this:

<Query>
<OrderBy>
<FieldRef Name=”Modified” Ascending=”FALSE”/>
</OrderBy>
<Where>
<Eq>
<FieldRef Name=”colShowHomePage”/>
<Value Type=”Boolean”>1</Value>
</Eq>
</Where>
</Query>
<Aggregations Value=”Off”/>
<RowLimit>10</RowLimit>
<Mobile MobileSimpleViewField=”colCustomLink” MobileItemLimit=”3″/>

<Toolbar Type=”Standard” /><XslLink Default=”TRUE”>main.xsl</XslLink>

Tips:

To display the view web part on other pages, use baseviewid in schema.xml for the list.

Don’t add or touch parameter binding tags in the XML.

Put custom lists in separate features to avoid list type conflicts on deployment

Leave a Reply