Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In a module, I'm deploying a webpart page where I put a view to a list :

  <View WebPartZoneID="Body"            
        WebPartOrder="3"
        List="related"
        BaseViewID="4"
        Scope="Recursive"
        Name="Documents">
  </View>

This is working.

Now I want to connect this resulting webpart with a QueryStringFilterWebPart.

In order to declare the connection, I have to know the ID of the Webpart.

How can I set up the id of the resulting webpart?

Here is what I tried :

use a AllUserWebPart node instead of a view :

First, I replace the view node by this one :

<AllUsersWebPart ID="relatedDocumentsView"
                   WebPartOrder="2"
                   WebPartZoneID="Body"
       >
    <![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>$Resources:core,ImportErrorMessage;</importErrorMessage>
        </metaData>
        <data>
          <properties>
            <property name="Title" type="string">Documents rattachés</property>
            <property name="Description" type="string">My WebPart</property>
            <property name="ListUrl" type="string">related</property>
    <property name="TitleUrl" type="string">#</property>
    <property name="BaseViewID" type="int">4</property>
         </properties>
        </data>
      </webPart>
    </webParts>]]>
  </AllUsersWebPart>

Then I setup the connection :

<WebPartConnection ID="connectionFilterRelatedDocuments"
                     ProviderID="queryStringFilterProvider"
                     ProviderConnectionPointID="ITransformableFilterValues"
                     ConsumerID="relatedDocumentsView"
                     ConsumerConnectionPointID="DFWP Filter Consumer ID">
    <WebPartTransformer Assembly="Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c"
                        Namespace="Microsoft.SharePoint.WebPartPages">
      <![CDATA[<WebPartPages:TransformableFilterValuesToParametersTransformer
      ConsumerFieldNames="RelatedCase"
      ProviderFieldNames="QueryString"
      />]]>
    </WebPartTransformer>
  </WebPartConnection>

This is nearly working. Actually, the connection is made between the webparts, but the view has two problems :

  1. The baseviewID is not correctly applied. I have to set it up manually after the deployment.
  2. The view is not considered as a webpart view. If I go to the webpart properties, I choose to customize the view. The screen is asking me for a view name, and a view url (same as a view from the library itselft).
  3. If I add a group by clause with SPD (a group by that is working perfectly in the view from the library itself), I get an mystical

Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))

Try to set up the ID

Whether I setup the id using

  <View WebPartZoneID="Body"
        Url="Pages/home.aspx"
        WebPartOrder="3"
        List="related"
        BaseViewID="4"
        Scope="Recursive"
        Name="Documents">
    <![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" type="string">Documents</property>
          <property name="TitleUrl" type="string">#</property>
          <property name="ID" type="string">relatedDocumentsView</property>
        </properties>
    </data>
</webPart>
</webParts>
]]>
  </View>

Or :

  <View WebPartZoneID="Body"
        Url="Pages/home.aspx"
        WebPartOrder="3"
        ID="relatedDocumentsView"
        List="related"
        BaseViewID="4"
        Scope="Recursive"
        Name="Documents"/>

, the WebPart is deployed and working, but the connection is not made. I'm quite sure it's because of the ID that is not set.

I know I can connect the webpart from a feature receiver, but I'd like to keep my full xml deployment model.

Does anyone know how can I specify the ID, or properly connect my webparts?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.