AnsweredAssumed Answered

Unable to set IPIAppIdentity identifier

Question asked by SivaR on Apr 16, 2018
Latest reply on Apr 20, 2018 by gregor

Hello All,

I have the following VB code snippet to set a trusted app identifier from OSISoft. This seems to crash the application on the line [Set AppId = gPISDKObj]. If i comment out that line and the next one it seems to run just fine.

Any ideas what could be wrong here? We are using PI SDK version 1.3.

 

Thanks, Appreciate the help!

Siva

 

Sub Main

Dim srv As Server

           Dim pt As PIPoint

 

           Dim gPISDKObj As PISDK.PISDK

           Dim sGuid As String

           Dim AppId As PISDK.IPIAppIdentity

 

           On Error GoTo HANDLER

 

           Set gPISDKObj = New PISDK.PISDK

           sGuid = "********-****-****-************"

           Set AppId = gPISDKObj

           AppId.Identifier = sGuid

 

           Set srv = gPISDKObj.Servers("PIServer")

           srv.Open()

 

           'Get pi point

           Dim ptatr As PointAttribute

           Dim stratr As String

 

           Set pt = srv.PIPoints("OSIDEMO_Clear Fork.Avg 30d Downtime")

 

           For Each ptatr In pt.PointAttributes

           stratr = stratr + ptatr.Name + ": " + ptatr.Value + vbCrLf

           Next

 

           MsgBox(stratr,vbOkOnly,pt.Name)

 

           Exit Sub

 

           HANDLER:

           MsgBox Err.Description

End Sub

Outcomes