Connecting TreeView Web Part Programmatically

Discussion created by suhas.gundoor on May 3, 2011
Latest reply on May 4, 2011 by pkaiser

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 and PI Webparts 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)








We beleive the connection is programatically possible in Sharepoint and below is the link for some more info on this: