Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

PIServer.Connect Method (String, String, AFConnectionPreference)

PIServer.Connect Method (String, String, AFConnectionPreference)

  • Last UpdatedNov 18, 2025
  • 2 minute read
PIServer.Connect Method (String, String, AFConnectionPreference)
Connects to the server using the specified credentials to allow sending and retrieving data.

Namespace:  OSIsoft.AF.PI
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public void Connect(
	string clientID,
	string clientSecret,
	AFConnectionPreference preference
)
Public Sub Connect ( 
	clientID As String,
	clientSecret As String,
	preference As AFConnectionPreference
)

Dim instance As PIServer
Dim clientID As String
Dim clientSecret As String
Dim preference As AFConnectionPreference

instance.Connect(clientID, clientSecret, 
	preference)
public:
void Connect(
	String^ clientID, 
	String^ clientSecret, 
	AFConnectionPreference preference
)
member Connect : 
        clientID : string * 
        clientSecret : string * 
        preference : AFConnectionPreference -> unit 

Parameters

clientID
Type: SystemString
The Client Id to use when requesting an Access Token from the Identity Server.
clientSecret
Type: SystemString
The Client Secret to use when requesting an Access Token from the Identity Server.
preference
Type: OSIsoft.AFAFConnectionPreference
The connection preference to use when determining which member of the PICollective is selected for the connection. The default preference can be obtained from Preference property of the this object's ConnectionInfo. The Preference setting will be updated to this value after a successful connection.

Exceptions

ExceptionCondition
PIConnectionExceptionA connection to the PI Data Archive server cannot be made.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in