Have you ever tried add a list web part (like "Shared Documents") to the default landing page of your site, but seem unable to to change the title of the webpart, frame type etc. as the code differs from that of a standard web part?

Recently I had a requirement for a site template that should by default create a document library with 2 new views ("My Items" and "My Edited Items"), the landing page of the site should also display two web parts of the document library: one displaying the "My Items" view and the other the "My Edited Items" view.

When you add a standard web part to a site template you generally have something like the following code:

<AllUsersWebPart WebPartZoneID="Right" WebPartOrder="1">
<![CDATA[<WebPart ... >
<Assembly>...</Assembly>
<TypeName>...</TypeName>

<Title>...</Title>
<FrameType>...</FrameType>
   etc, etc, etc
</WebPart>]]>
</AllUsersWebPart>

Now when you want to add a web part for a document library or list, you have to put in the following type of code:

<View List="MyCustomDocumentLibrary" BaseViewID="13" WebPartZoneID="MiddleRight" />

Simply add the following code to the list view web part:

<View List="MyCustomDocumentLibrary" BaseViewID="13" WebPartZoneID="MiddleLeft" >
<![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>
<FrameType>TitleBarOnly</FrameType>
<Title>My Edited Documents</Title>
<Toolbar>None</Toolbar>
<!-- Add your other tag changes here -->
</WebPart>]]>
</View>

Note: I added the <![CDATA[ attributes of a standard web part into my document library list view and ensured that the <TypeName> attribute was that of a ListViewWebPart.

You may want to change the type of toolbar that is displayed for a document library web part (eg: summary), unfortunately I have not worked this one out yet.

Regards,

Doug "bobthebuilder" McCusker