2 Replies Latest reply on May 16, 2014 12:26 PM by snepes

    Problem to Get Module c#




      I'm trying get module, but I don't  know yet.


      I used two ways for get Module, but didn't work.



      • 1º way:

                     PISDK.PIModule modulo = PIACEBIFunctions.GetPIModuleFromPath(this.Context);

      • 2º way:

                    PIModule listaModulo = server.PIModuleDB.PIModules[0];


      Both ways return null and I have three modules.


      Could anybody help me?

        • Re: Problem to Get Module c#
          Marcos Vainer Loeff

          Hi Ludimila,


          Concerning the second way, you should use the module name as the input string to find the interested module (do not use interger). Another option is to  use foreach to retrieve information for each module. Please refer to the code snippet below:





                      PISDK.PISDK sdkroot = new PISDK.PISDK();
                      Server myServer = sdkroot.Servers["MARC-PI2010"];
                      foreach (PISDK.PIModule myCurrentModule in myServer.PIModuleDB.PIModules)
                      PISDK.PIModule myCurrentModule2 = myServer.PIModuleDB.PIModules["%OSI"];

           Hope this helps!