Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

April 16, 2007

MOSS: Setting list view title in ONET.XML

Problem:
Title of a list view (ListViewWebPart) cannot be defined in ONET.XML so it cannot be set different from the title of the list it is showing.

If I modify the title with a browser (Modify Shared Web Part / Appearance / Title) and save the site as a template the new title is nowhere in the .stp file, still if I use that template to create a site the changes are there.

Solution:
Use the WebPart tag and define the Title under it. In the following example a minimized List View Web Part is added with a title My custom title.

<View List="Documents" BaseViewID="11"
WebPartZoneID="Left" WebPartOrder="3" Scope="Recursive">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
<Title>My custom title</Title>
<FrameState>Minimized</FrameState>
</WebPart>
]]>
</View>