在我的自定义 SharePoint 2010 网站定义中:
- 我的站点定义中有一个具有多个视图的自定义列表实例...
- 我有一个页面,我想显示其中一个视图...
- 在页面的 Elements.xml 定义中,我可以在哪里选择显示下面列表实例的 Schema.xml 中显示的“通信”或“会计”视图?
XML 已被清理以简化阅读。
列出实例的 Schema.xml
<List Title="Client Documents" Direction="none" Url="Client Documents" BaseType="1" Type="101" BrowserFileHandling="Permissive" EnableContentTypes="TRUE" DisableAttachments="TRUE" Catalog="FALSE" VersioningEnabled="TRUE" SendToLocation="|" ImageUrl="/_layouts/images/itdl.png" xmlns:ows="Microsoft SharePoint" xmlns:spctf="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>...</ContentTypes>
<Fields>...</Fields>
<Forms />
<Views>
...
<View DisplayName="CORE Client - Accounting" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Forms/CORE Client Accounting.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<Where>
<Eq>
<FieldRef Name="ContentType" />
<Value Type="Computed">Client - Accounting</Value>
</Eq>
</Where>
</Query>
<ViewFields>...</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="CORE Client - Correspondence" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Forms/CORE Client Correspondence.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Client_x0020_Correspondence_x0020_Type" />
</GroupBy>
<Where>
<Eq>
<FieldRef Name="ContentType" />
<Value Type="Computed">Client - Correspondence</Value>
</Eq>
</Where>
</Query>
<ViewFields>...</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
...
</Views>
</MetaData>
</List>
模块的 Elements.xml
<File Url="ClientDocumentsCorrespondence.aspx" Path="default.aspx" Type="GhostableInLibrary" >
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/PLClientDocuments.aspx" />
<Property Name="Title" Value="GASOP Client Documents - Correspondence" />
<Property Name="ContentType" Value="Welcome Page" />
<AllUsersWebPart WebPartOrder="0" WebPartZoneID="zone1">...</AllUsersWebPart>
<AllUsersWebPart WebPartOrder="1" WebPartZoneID="zone1">...</AllUsersWebPart>
<View List="Client Documents"
DisplayName=""
Url=""
DefaultView="FALSE"
BaseViewID="1"
Type="HTML"
WebPartOrder="0"
WebPartZoneID="zone2"
ContentTypeID="0x"
ID="g_4d8c86ec_b324_4f6a_a2e9_ba1a36466c68"
Hidden="TRUE">
<![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>...</properties>
</data>
</webPart>
</webParts>]]>
</View>
</File>