2011-08-09 91 views
0

列表視圖添加到發佈頁面是因爲很長一段時間是一個大問題,現在我面對它.... 我不得不通過CAML添加列表視圖Web部件發佈頁面。 我用的代碼:如何通過CAML供應

<View List="0GeneralInformationandReports" RowLimit="5" FreeForm="TRUE" 
    BaseViewID="0" 
    RecurrenceRowset="TRUE" 
    WebPartZoneID="bottomLeft_LeftZone" 
    WebPartOrder="1"> 
    <![CDATA[ 
     <webParts> 
       <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> 
        <metaData> 
         <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" /> 
         <importErrorMessage>Cannot import this Web Part.</importErrorMessage> 
        </metaData> 
        <data> 
         <properties> 
          <property name="Title">0 - General Information and Reports</property> 
          <property name="AllowConnect" type="bool">True</property> 
          <property name="AllowClose" type="bool">False</property> 
          <property name="Height" type="unit">215px</property> 
         </properties> 
        </data> 
       </webPart> 
      </webParts>   
    ]]> 
    </View> 

,它是呈現精緻與頁面上的列表視圖。但我必須添加更多的控制到Web部分,如只顯示有限的列和按日期升序修改的前5個。這是不工作的使用標籤,因爲沒有其他方式可以添加排序,查看字段等... 請幫助。


我試過了,仍然不能正常工作。這是我在schema.xml中的列表視圖。

<View DisplayName="" BaseViewID="0" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" Hidden="TRUE" XslLink="main.xsl" 
     WebPartZoneID="bottomLeft_LeftZone" WebPartOrder="0"> 
    <XslLink>main.xsl</XslLink> 
    <Query /> 
    <ViewFields> 
     <FieldRef Name="DocIcon" /> 
     <FieldRef Name="LinkFilenameNoMenu" /> 
    </ViewFields> 
    <RowLimit>5</RowLimit> 
    <Aggregations Value="Off" /> 
    </View> 
    </Views> 

不過它顯示相同的字段...沒有想法如何得到它。我已經在我的elements.xml中的參考基本視點=「0」。仍然沒有運氣。

回答

0

爲了做到這一點,你可能在你的列表定義來定義一個新視圖,然後用BaseViewID指定由該ID的新觀點。