PICollective.SwitchMember Method (Boolean, IWin32Window, PICollectiveMember)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
The SwitchMember method is used to change to the specified
member of the collective with a credential prompt if necessary.
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void SwitchMember( bool autoPrompt, IWin32Window owner, PICollectiveMember member )
Public Sub SwitchMember ( autoPrompt As Boolean, owner As IWin32Window, member As PICollectiveMember ) Dim instance As PICollective Dim autoPrompt As Boolean Dim owner As IWin32Window Dim member As PICollectiveMember instance.SwitchMember(autoPrompt, owner, member)
public: void SwitchMember( bool autoPrompt, IWin32Window^ owner, PICollectiveMember^ member )
member SwitchMember : autoPrompt : bool * owner : IWin32Window * member : PICollectiveMember -> unit
Parameters
- autoPrompt
- Type: SystemBoolean
If , then a dialog will be displayed to prompt for user credentials if the connection to the server fails. The choice of PIAuthenticationMode in the prompt dialog is only displayed if the AllowExplicit option is set in the AuthenticationOptions setting. When this option is not set, then only WindowsAuthentication is allowed. - owner
- Type: System.Windows.FormsIWin32Window
The handle to the window that owns the credential prompt dialog. If , then the owner will be the desktop. This parameter is only used if autoPrompt is and there is a security error when attempting to connect to the PI AF Server. - member
- Type: OSIsoft.AF.PIPICollectiveMember
The preferred member of the PICollective selected for the connection. If the member is not available, then the connection will failover to another member.
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 to the specified member if the current Priority settings allow a connection to this member. 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.