1

私のカスタム SharePoint 2010 サイト定義では:

  1. サイト定義に複数のビューを持つカスタム リスト インスタンスがあります...
  2. ビューの1つを表示したいページがあります...
  3. ページの Elements.xml 定義では、以下のリスト インスタンスの Schema.xml に示されている「Correspondence」ビューまたは「Accounting」ビューのどちらを表示するかを選択できますか?

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>
4

1 に答える 1

1

2 つのビューを作成しているようですschema.xmlが、どちらも同じ BaseViewID を持っています。BaseViewIDビューごとに一意である必要があります。1 は AllItems ビュー (デフォルト ビュー) の ID です。

この投稿を参照してください: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/52e45ddd-73a8-400f-890c-323a0eaaeccb

default viewの一意の ID をコピーして貼り付けて指定しBaseViewIDます。

あなたよりもModule's Elements.xml

  <View List="Lists/Client Documents" BaseViewID="<<Your View Unique ID>>"  DisplayName="Client Documents" Name="Client Documents" RecurrenceRowset="TRUE" WebPartZoneID="Main" WebPartOrder="0">
      <![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">Invoice Approved</property>
                          <property name="AllowConnect" type="bool">True</property>
                          <property name="AllowClose" type="bool">False</property>
                      </properties>
                  </data>
              </webPart>
          </webParts>
      ]]>
    </View>

詳細については、http: //blog.qumsieh.ca/2010/09/01/sharepoint-2010-schema-xml-onet-xml-and-toolbar-type/をお読みください。

于 2013-03-28T06:39:35.660 に答える