Share via


4.3.1.1 Get the List of Web Parts in a Web Part Page

To obtain the list of Web Parts in the page, the client can send a GetWebPartProperties2 request to the server, and the server response GetWebPartProperties2Response will contain the list of Web Parts in all Web Part zones currently in the page.

A sample request is similar to the following:

 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
       <GetWebPartProperties2 xmlns="http://microsoft.com/sharepoint/webpartpages">
          <pageUrl>%2fdefault.aspx</pageUrl>
          <storage>Shared</storage>
          <behavior>Version3</behavior>
       </GetWebPartProperties2>
    </soap:Body>
 </soap:Envelope>

A sample response is similar to the following:

 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetWebPartProperties2Response xmlns="http://microsoft.com/sharepoint/webpartpages">
          <GetWebPartProperties2Result>
             <WebParts>
                <WebPart ID="a4439cb8-de06-4f59-8698-4296fb3d7955">
                   <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="InitialAsyncDataFetch" type="bool">False</property>
                        <property name="ChromeType" type="chrometype">Default</property>
                        <property name="Title" type="string" />
                        <property name="Height" type="string" />
                        <property name="CacheXslStorage" type="bool">True</property>
                        <property name="ListDisplayName" type="string" null="true" />
                        <property name="AllowZoneChange" type="bool">True</property>
                        <property name="AllowEdit" type="bool">True</property>
                        <property name="XmlDefinitionLink" type="string" />
                        <property name="DataFields" type="string" />
                        <property name="Hidden" type="bool">False</property>
                        <property name="ListName" type="string">{9C26F0DF-2200-4773-81BF-DD86F8649CB9}</property>
                        <property name="NoDefaultStyle" type="string" />
                        <property name="AutoRefresh" type="bool">False</property>
                        <property name="ViewFlag" type="string">8396813</property>
                        <property name="Direction" type="direction">NotSet</property>
                        <property name="AutoRefreshInterval" type="int">60</property>
                        <property name="AllowConnect" type="bool">True</property>
                        <property name="Description" type="string" />
                        <property name="AllowClose" type="bool">True</property>
                        <property name="ShowWithSampleData" type="bool">False</property>
                        <property name="ParameterBindings" type="string">
                           &lt;ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/&gt;
                           &lt;ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/&gt;
                           &lt;ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/&gt;
                           &lt;ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/&gt;
                           &lt;ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" /&gt;
                           &lt;ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" /&gt;
                           &lt;ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" /&gt;
                           &lt;ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" /&gt;
                           &lt;ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noevents_toaddeventclickaddnewevent)" /&gt;
                           &lt;ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noevents_toaddeventclickaddnewevent_howto)" /&gt;
                           &lt;ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,AddNewEvent)" /&gt;
                           &lt;ParameterBinding Name="MoreAnnouncements" Location="Resource(wss,more_events)" /&gt;
                        </property>
                        <property name="Xsl" type="string" null="true" />
                        <property name="CacheXslTimeOut" type="int">86400</property>
                        <property name="WebId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">00000000-0000-0000-0000-000000000000</property>
                        <property name="ListUrl" type="string" null="true" />
                        <property name="DataSourceID" type="string" />
                        <property name="FireInitialRow" type="bool">True</property>
                        <property name="ManualRefresh" type="bool">False</property>
                        <property name="ViewFlags" type="Microsoft.SharePoint.SPViewFlags, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Html, TabularView, Hidden, RecurrenceRowset, Mobile</property>
                        <property name="ChromeState" type="chromestate">Normal</property>
                        <property name="AllowHide" type="bool">True</property>
                        <property name="PageSize" type="int">-1</property>
                        <property name="SampleData" type="string" null="true" />
                        <property name="BaseXsltHashKey" type="string" null="true" />
                        <property name="AsyncRefresh" type="bool">False</property>
                        <property name="HelpMode" type="helpmode">Modeless</property>
                        <property name="ListId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">9c26f0df-2200-4773-81bf-dd86f8649cb9</property>
                        <property name="DataSourceMode" type="Microsoft.SharePoint.WebControls.SPDataSourceMode, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">List</property>
                        <property name="AllowMinimize" type="bool">True</property>
                        <property name="TitleUrl" type="string">/Lists/Calendar</property>
                        <property name="CatalogIconImageUrl" type="string" />
                        <property name="DataSourcesString" type="string" />
                        <property name="GhostedXslLink" type="string">main.xsl</property>
                        <property name="PageType" type="Microsoft.SharePoint.PAGETYPE, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">PAGE_NORMALVIEW</property>
                        <property name="DisplayName" type="string" />
                        <property name="UseSQLDataSourcePaging" type="bool">True</property>
                        <property name="Width" type="string" />
                        <property name="ExportMode" type="exportmode">All</property>
                        <property name="XslLink" type="string" null="true" />
                        <property name="ViewContentTypeId" type="string" />
                        <property name="HelpUrl" type="string" />
                        <property name="XmlDefinition" type="string">&lt;View Name="{A4439CB8-DE06-4F59-8698-4296FB3D7955}" MobileView="TRUE" Type="HTML" Hidden="TRUE" RecurrenceRowset="TRUE" DisplayName="" Url="/default.aspx" Level="1" BaseViewID="0" ContentTypeID="0x"&gt;
                           &lt;Query&gt;&lt;Where&gt;&lt;DateRangesOverlap&gt;&lt;
 FieldRef Name="EventDate"/&gt;
                           &lt;FieldRef Name="EndDate"/&gt;
                           &lt;FieldRef Name="RecurrenceID"/&gt;
                           &lt;Value Type="DateTime"&gt;&lt;Now/&gt;
                           &lt;/Value&gt;&lt;/DateRangesOverlap&gt;
                              &lt;/Where&gt;&lt;/Query&gt;
                              &lt;ViewFields&gt;&lt;FieldRef Name="EventDate" Explicit="TRUE"/&gt;
                              &lt;FieldRef Name="LinkTitleNoMenu" Explicit="TRUE"/&gt;
                              &lt;FieldRef Name="Description" Explicit="TRUE"/&gt;
                              &lt;FieldRef Name="Attachments" Explicit="TRUE"/&gt;
                              &lt;FieldRef Name="fRecurrence" Explicit="TRUE"/&gt;
                              &lt;/ViewFields&gt;
                              &lt;RowLimit&gt;10&lt;/RowLimit&gt;
                              &lt;Toolbar Type="Freeform"/&gt;
                              &lt;/View&gt;
                           </property>
                           <property name="Default" type="string" />
                           <property name="TitleIconImageUrl" type="string" />
                           <property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
                           <property name="SelectParameters" type="string" />
                        </properties>
                     </data>
                  </webPart>
               </WebPart>
            </WebParts>
          </GetWebPartProperties2Result>
       </GetWebPartProperties2Response>
    </soap:Body>
 </soap:Envelope>