none
How to provision connected webpart on a custom page? RRS feed

  • Question

  • Hi All,

    I want to provision custom connected webparts on a custom webpart page in sharepoint solution.

    Please suggest me the alternatives available.

    Appreciate your help.

    Thanks,

    Rahul Babar


    ASP.NET, C# 4.0, Sharepoint 2007/2010, Infopath 2007/2010 Developer

    Tuesday, August 7, 2012 3:11 PM

Answers

  • If you are familiar with the <AllUserWebPart> tag then you should be able to provision WebParts using the CAML in the Elements.xml when building a Package.

    All you need to do is add two <AllUserWebPart> tags followed by a <WebPartConnection> Tag in the <File> tag in <Module> Section of Elements.xml.

    Your Elements.xml will then look something similar to this - 

    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="Module1">
        <File Path="Module1\default.aspx" Url="demo.aspx">
          <AllUsersWebPart ID="testProvider">...</AllUsersWebPart>
          <AllUsersWebPart ID="testConsumer">...</AllUsersWebPart>
          <WebPartConnection ID="testConnection"
                             ProviderID="testProvider"
                             ProviderConnectionPointID="providerID"
                             ConsumerID="testConsumer"
                             ConsumerConnectionPointID="consumerID" />
         </File>
      </Module>
    </Elements>

    • Marked as answer by Rahul Babar Wednesday, August 8, 2012 6:41 PM
    Tuesday, August 7, 2012 7:44 PM

All replies

  • If you are familiar with the <AllUserWebPart> tag then you should be able to provision WebParts using the CAML in the Elements.xml when building a Package.

    All you need to do is add two <AllUserWebPart> tags followed by a <WebPartConnection> Tag in the <File> tag in <Module> Section of Elements.xml.

    Your Elements.xml will then look something similar to this - 

    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="Module1">
        <File Path="Module1\default.aspx" Url="demo.aspx">
          <AllUsersWebPart ID="testProvider">...</AllUsersWebPart>
          <AllUsersWebPart ID="testConsumer">...</AllUsersWebPart>
          <WebPartConnection ID="testConnection"
                             ProviderID="testProvider"
                             ProviderConnectionPointID="providerID"
                             ConsumerID="testConsumer"
                             ConsumerConnectionPointID="consumerID" />
         </File>
      </Module>
    </Elements>

    • Marked as answer by Rahul Babar Wednesday, August 8, 2012 6:41 PM
    Tuesday, August 7, 2012 7:44 PM
  • Thanks a lot Vijay for solution with example.

    Appreciate your help.

    Thanks,

    Rahul Babar


    ASP.NET, C# 4.0, Sharepoint 2007/2010, Infopath 2007/2010 Developer

    Wednesday, August 8, 2012 6:41 PM