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

AF SDK Reference

PISystems Constructor (String, String, Boolean)

  • Last UpdatedNov 18, 2025
  • 2 minute read
PISystems Constructor (String, String, Boolean)
Initializes a new instance of the PISystems collection with for the specified client Id with an option to create an independent cache.

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

Syntax

public PISystems(
	string clientId,
	string clientSecret,
	bool forceNewInstance = false
)
Public Sub New ( 
	clientId As String,
	clientSecret As String,
	Optional forceNewInstance As Boolean = false
)

Dim clientId As String
Dim clientSecret As String
Dim forceNewInstance As Boolean

Dim instance As New PISystems(clientId, 
	clientSecret, forceNewInstance)
public:
PISystems(
	String^ clientId, 
	String^ clientSecret, 
	bool forceNewInstance = false
)
new : 
        clientId : string * 
        clientSecret : string * 
        ?forceNewInstance : bool 
(* Defaults:
        let _forceNewInstance = defaultArg forceNewInstance false
*)
-> PISystems

Parameters

clientId
Type: SystemString
Client Id used to authenticate with OIDC.
clientSecret
Type: SystemString
Client Secret used to authenticate with OIDC.
forceNewInstance (Optional)
Type: SystemBoolean
Set to to force the creation of an independent collection of PISystems for the current client id with a separate cache.

Examples

ClaimsIdentity testAccountIdentity = new ClaimsIdentity();
testAccountIdentity = new ClaimsIdentity();
testAccountIdentity.AddClaim(new Claim("id", TestAccountName));
testAccountIdentity.AddClaim(new Claim("access_token", TestAccountAccessToken));

PISystems myPISystems = new PISystems(testAccountIdentity);

PISystem piSystem = myPISystems.DefaultPISystem;
piSystem.Connect();
Console.WriteLine("CurrentUserName = {0}", piSystem.CurrentUserName);
Console.WriteLine("AuthenticationType = {0}", piSystem.ConnectionInfo.AuthenticationType);
Console.WriteLine();

piSystem = myPISystems[AFServerMachine2];
piSystem.Connect();
Console.WriteLine("CurrentUserName = {0}", piSystem.CurrentUserName);
Console.WriteLine("AuthenticationType = {0}", piSystem.ConnectionInfo.AuthenticationType);
Console.WriteLine();

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1

See Also

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