4 Replies Latest reply on Feb 5, 2015 10:42 PM by jamliu

    SharePoint 2013 - Connect Custom WebPart with Trend WebPart

    drausim127@spiratec

      Hi,

       

      a few years ago I created a connectable custom webpart based on a OSIsoft documentation. This webpart was able to make connection between my custom webpart and the OSIsoft PI Trend webpart.

       

      In those days Sharepoint 2007 was the current version. Now SharePoint 2013 is the current one.

       

      Is there an OSIsoft documentation available where is described how to create a connectable SharePoint 2013 WebPart in combination with SharePoint 2013? In Visual Studio some information is displayed that IRowProvider shouldn't be used because it is obsolete.

       

      In advance thank you very much for your support.

       

      Best regards

        • Re: SharePoint 2013 - Connect Custom WebPart with Trend WebPart
          drausim127@spiratec

          I made a mistake. I wanted to write: in combination with OSIsoft PI WebParts 2013 and not SharePoint 2013

            • Re: SharePoint 2013 - Connect Custom WebPart with Trend WebPart

              Hello Markus,

               

              To my understanding the whole Microsoft.SharePoint.WebPartPages.Communication namespace has been marked obsolete. I wouldn't know we have any documentation on creating custom web parts for SharePoint 2013. I suggest doing some Internet research. I found a video at youtube about How to create a visual webpart in SharePoint 2013 you may find useful.

                • Re: SharePoint 2013 - Connect Custom WebPart with Trend WebPart
                  imuehlenhoff

                   Hi,

                   

                  we have used this mechanism in a recent sharepoint 2013 project in order to communicate with the OSIsoft Webparts. Beside the Rowprovider Interface is marked as obsolete there is no way i am currently know to avoid it if you want to communicate with the webparts

                   

                   

                   

                  Please find this sample code of a webpart class. It is not complete, and not compileable but should contain all neceassary methods for the rowprovider connection.

                   
                   public partial class webpartclass : Microsoft.SharePoint.WebPartPages.WebPart, IRowProvider, IWebEditable
                      {
                  
                   private string[] fieldnames = new string[] {"ValuetoProvide" };
                  
                   public event RowProviderInitEventHandler RowProviderInit;
                   public event RowReadyEventHandler RowReady;
                  
                   [Obsolete]
                          public override void EnsureInterfaces()
                          {
                              //Register Interface for RowProvider
                              RegisterInterface("TagListProvider_WPQ_", InterfaceTypes.IRowProvider, UnlimitedConnections, CanRunAt(), this, "TagListProvider_WPQ_", "", "");           
                             
                          }
                  
                          [Obsolete]
                          public override ConnectionRunAt CanRunAt()
                          {
                              return ConnectionRunAt.Server;
                          }
                  
                  
                          [Obsolete]
                          public override void PartCommunicationConnect(string interfaceName, Microsoft.SharePoint.WebPartPages.WebPart connectedPart, string connectedInterfaceName, ConnectionRunAt runAt)
                          {
                              paramsOutConnected = true;
                          }
                  
                          [Obsolete]
                          public override void PartCommunicationInit()
                          {
                             
                                  RowProviderInitEventArgs rowProviderInitEventArgs = new RowProviderInitEventArgs();
                  
                                  rowProviderInitEventArgs.FieldList = fieldnames;
                  
                                  // Set the row field display names.
                                  rowProviderInitEventArgs.FieldDisplayList = fieldnames;
                  
                                  // Fire the RowProviderInit event.
                                  RowProviderInit(this, rowProviderInitEventArgs);
                  
                            
                          }
                  
                          public override InitEventArgs GetInitEventArgs(string interfaceName)
                          {
                              RowProviderInitEventArgs rowProviderInitEventArgs = null;
                              
                                  // Check if this is my particular row interface.
                                  if (interfaceName == "TagListProvider_WPQ_")
                                  {
                                      // Ensure controls have been created.
                                      EnsureChildControls();
                  
                                      // Create the RowProviderInitEventArgs object for the 
                                      // RowProviderInit event.
                                      rowProviderInitEventArgs = new RowProviderInitEventArgs();
                  
                                      // Set the field names.
                                      rowProviderInitEventArgs.FieldList = _fieldnames;
                  
                                      // Set the field display names.
                                      rowProviderInitEventArgs.FieldDisplayList = _fieldnames;
                                  }
                            
                              // return the RowProviderInitEventArgs object.
                              return rowProviderInitEventArgs;
                          }
                        [Obsolete]
                          public override void PartCommunicationMain()
                          {
                            
                                  EnsureChildControls();
                                  RowReadyEventArgs rowReadyEventArgs = new RowReadyEventArgs();
                                  //Create a Datatable with one single row and provide it to the other webparts
                                  DataTable dtbl = new DataTable();
                                  dtbl.Columns.Add("ValuetoProvide");            
                                  dtbl.Rows.Add("Value");
                  
                                  DataRow[] dr = new DataRow[1];
                                  dr[0] = dtbl.Rows[0];
                                  rowReadyEventArgs.Rows = dr;
                                  rowReadyEventArgs.SelectionStatus = "Standard";
                                  // Fire the RowReady event.
                                  RowReady(this, rowReadyEventArgs);
                             
                          }
                  }
                  

                   

                    • Re: SharePoint 2013 - Connect Custom WebPart with Trend WebPart
                      jamliu

                      Hi Ingo,

                      I had developed a custom webpart with "IParametersOutProvider" interface to send the tag path to the PI Trend webpart via client-side connection. It was working perfectly in SP2010 with PI Webpart 2010, and even SP2013 with PI Webpart 2013 SP1, but is now getting the "Web Part Error:There is no valid configuration for these connected parts to run in" error after the PI Webpart 2013 SP2 upgrade. Any idea? Thanks.