PICollective.SwitchMember Method (NetworkCredential, PIAuthenticationMode, AFConnectionPreference)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
The SwitchMember method is used to change the currently connected
member of the collective using the specified credentials.
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void SwitchMember( NetworkCredential credential, PIAuthenticationMode authenticationMode, AFConnectionPreference preference = AFConnectionPreference.Any )
Public Sub SwitchMember ( credential As NetworkCredential, authenticationMode As PIAuthenticationMode, Optional preference As AFConnectionPreference = AFConnectionPreference.Any ) Dim instance As PICollective Dim credential As NetworkCredential Dim authenticationMode As PIAuthenticationMode Dim preference As AFConnectionPreference instance.SwitchMember(credential, authenticationMode, preference)
public: void SwitchMember( NetworkCredential^ credential, PIAuthenticationMode authenticationMode, AFConnectionPreference preference = AFConnectionPreference::Any )
member SwitchMember : credential : NetworkCredential * authenticationMode : PIAuthenticationMode * ?preference : AFConnectionPreference (* Defaults: let _preference = defaultArg preference AFConnectionPreference.Any *) -> unit
Parameters
- credential
- Type: System.NetNetworkCredential
The NetworkCredential to use when connecting to the server. - authenticationMode
- Type: OSIsoft.AF.PIPIAuthenticationMode
Specifies the type of authentication to be used when making the connection. The specified credential must match the type of authentication. - preference (Optional)
- Type: OSIsoft.AFAFConnectionPreference
The connection preference to use when determining which member of the PICollective is selected for the connection. The current connection failover behavior is not modified. Use Any to switch to the next collective member based upon the current connection's failover behavior.
Exceptions
| Exception | Condition |
|---|---|
| PIVersionNotSupportedException | This exception will be generated when attempting to connect to a PIServer with using WindowsAuthentication and the server does not support this mode of authentication. |
Remarks
This method will change the currently connected member of the collective based upon the specified preference and the current Priority settings of the collective members for the current connection. This method will not modify the current failover behavior of the PICollective established with the initial connection to the collective.
A direct connection can be made to a collective member using one of the PICollectiveMember.Connect Overload methods. If the current connection to a collective member is a direct connection, then this method will establish a normal failover connection before switching members.