2 Replies Latest reply on May 4, 2011 8:02 PM by pkaiser

    Connecting TreeView Web Part Programmatically

    suhas.gundoor

      Given below is the problem description -

       

       

       

      We are trying to programmatically connect the 'RtTreeView' web part with another web part and pass "NodePath" as a parameter to that consumer web part. The consumer web part in this case is a Microsoft SSRS Report Viewer web part.

       

      We are using SharePoint OM to achieve this.

       

      (We are using MS SharePoint 2007 SP2, PIAF 2.2.2.3870 and PI Webparts  3.0.0.0 versions.)

       

      But, we are getting a "NullReferenceException" when we try to get the provider connection points of the 'RtTreeView' web part.

       

      Any help on this is greatly appreciated!

       

       

       

      Given below is the code which is throwing error(The line at which we are seeing the error is highlighted in yellow):

       

       

       

      using (SPLimitedWebPartManager manager = web.GetLimitedWebPartManager("http://server/sites/sitecoll/page.aspx", PersonalizationScope.Shared))

       

      {

       

          TreeViewWP treeView = null;

       

       

       

          foreach (Microsoft.SharePoint.WebPartPages.WebPart webPart in manager.WebParts)

       

          {

       

              if (webPart.GetType().ToString().Equals("OSIsoft.RtWebParts.RtTreeView.TreeViewWP"))

       

              treeView = webPart as TreeViewWP;

       

          }

       

       

       

          ProviderConnectionPointCollection providerColl = manager.GetProviderConnectionPoints(treeView);

       

       

       

          foreach (ProviderConnectionPoint item in providerColl)

       

              MessageBox.Show(item.DisplayName);

       

      }

       

       

       

      We beleive the connection is programatically possible in Sharepoint and below is the link for some more info on this: http://kkryczka.wordpress.com/2011/01/12/preferred-rtwebpart-connections/#comment-1

       

       

       

      Regards,

       

      SG