Quick Tip: Provisioning a List View to a Web Part Page

Following on from my recent post (Provisioning Web Parts to a Page), I had a question asking how to do this for List Views. Below is a code sample showing how to do this…

    1: <?xml version="1.0" encoding="utf-8"?>
    2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
    3:   <Module Name="XYZCustomPages" RootWebOnly="True">    
    4:     <File Path="XYZCustomPages\Home.aspx" Url="Home.aspx" IgnoreIfAlreadyExists="true">      
    5:       <View List="Lists/Tasks" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="100">
    6:         <![CDATA[
    7:           <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
    8:             <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    9:             <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
   10:             <Title>My Tasks</Title>
   11:           </WebPart>
   12:         ]]>
   13:       </View>
   14:     </File>  
   15:   </Module>
   16: </Elements>


Rob Nowik

Senior Consultant

Microsoft Consulting Services UK