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

AF SDK Reference

AFCollectiveMember Class

  • Last UpdatedNov 18, 2025
  • 10 minute read
AFCollectiveMember Class
The AFCollectiveMember object is used to provide the information about the member server defined within the AFCollective.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.CollectiveAFCollectiveMember

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

Syntax

[SerializableAttribute]
public sealed class AFCollectiveMember : AFObject, 
	IComparable<AFCollectiveMember>, IEquatable<AFCollectiveMember>
<SerializableAttribute>
Public NotInheritable Class AFCollectiveMember
	Inherits AFObject
	Implements IComparable(Of AFCollectiveMember), IEquatable(Of AFCollectiveMember)

Dim instance As AFCollectiveMember
[SerializableAttribute]
public ref class AFCollectiveMember sealed : public AFObject, 
	IComparable<AFCollectiveMember^>, IEquatable<AFCollectiveMember^>
[<SealedAttribute>]
[<SerializableAttribute>]
type AFCollectiveMember =  
    class
        inherit AFObject
        interface IComparable<AFCollectiveMember>
        interface IEquatable<AFCollectiveMember>
    end

The AFCollectiveMember type exposes the following members.

Properties

  NameDescription
Public property
AccountName
This property is the account name that the PI AF Server for this AFCollectiveMember is executing under.
Public property
Collective
The AFCollective that owns the collective member.
Public property
CommunicationsGracePeriod
The communication grace period before the CommunicationStatus is set to TimedOutOnPrimary when there has not been any communication with the primary server.
Public property
CommunicationsPeriod
The communication period that the collective members use to determine each others status.
Public property
CommunicationStatus
The status of the communication between the members of the collective.
Public property
CredentialsAccountName Obsolete.
The account name used by the collective member to access primary server.
Public property
DatabaseVersion
Read-only property that contains a string that uniquely identifies the current database version.
Public property
Description
Read/write property that provides a more detailed description of the object.
Public property
Host
This property is the name of the host machine where the PI AF Server for this AFCollectiveMember is executing.
Public property
ID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
IsAvailable
Indicates if the collective member is available.
Public property
IsConnected
Indicates if the collective member is being used as the connection to the PI AF Server.
Public property
IsConnectedToPrimary
Indicates if the client is connected to the primary server within the collective.
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
LastCommunicationTime
The last communication time to the primary server within the collective.
Public property
LastSyncTime
The last synchronization time to the primary server within the collective.
Public property
Name
Read/write property that identifies the name of the object.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
Port
Read/write property that is the port number used to connect to the PI AF Server for this AFCollectiveMember on the remote host.
Public property
Priority
Indicates the priority order in which to select a collective member.
Public property
Protocol
Read/write property that is the protocol used to connect to the PI AF Server for this AFCollectiveMember on the remote host.
Public property
ServerRole
The role of the collective member server within the AFCollective.
Public property
ServerVersion
Read-only property that contains a string that uniquely identifies the current server version.
Public property
StreamedPort
Read-only property that is the port number used to connect to the streamed interface of the PI AF Server for this AFCollectiveMember on the remote host.
Public property
SyncStatus
The status of the synchronization between the members of the collective.
Public property
TimeOut
Read/write property that is the connection timeout used to connect to the PI AF Server for this AFCollectiveMember on the remote host.
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)

Methods

  NameDescription
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodCode example
Connect
Connects to the specific server within the AFCollective using default credentials to allow sending and retrieving data.
Public methodCode example
Connect(NetworkCredential)
Connects to the specific server within the AFCollective using the specified credentials to allow sending and retrieving data.
Public methodCode example
Connect(Boolean, IWin32Window)
Connects to the specific server within the AFCollective with a credential prompt if necessary to allow sending and retrieving data.
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFCollectiveMember)
Indicates whether the current object is equal to another object of the same type.
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public method
GetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
GetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
ReinitializeReplication
Reinitialize the collective member to replicate data between members.
Public method
SetCredentialsAccount Obsolete.
Set the account used to by the collective member to access primary server.
Public method
StartReplication
Initialize the collective member to start replication of data between members.
Public method
StopReplication
Stop the collective member from replicating data between members.
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)

Remarks

This class provides information about the member server defined with the AFCollective. This object is used to check status and change configuration options, but it is not a replacement for a PISystem object used to communicate with an PI AF Server. A PISystem representing the AFCollective and connected to one of the collective members can be obtained from the PISystems collection.

Changes to the collective server information can be saved to the server using one of the AFCollective.ApplyChanges Overload methods. If a new member is added to the collective, then the StartReplication method should be called to enable replication between the servers.

Examples

// This example demonstrates how to create and remove a collective.

// Add the PISystem to be used as the primary
PISystems myPISystems = new PISystems();
PISystem primary = myPISystems.Add(primaryName);
primary.Connect();

// Check if primary is already a collective
if (primary.Collective != null)
    throw new InvalidOperationException(string.Format("Primary '{0}' is already a collective.", primary.Name));

// Add the PISystem to be used as the secondary
PISystem secondary = myPISystems.Add(secondaryName);
secondary.Connect();

// Check if secondary is already a collective
if (secondary.Collective != null)
    throw new InvalidOperationException(string.Format("Secondary '{0}' is already a collective.", secondary.Name));

// Create the collective
AFCollective collective = primary.CreateCollective();
primary.Name = "Test-Collective";           // Change the collective name
primary.Description = "The Collective";     // Change the collective description

// Add members to the collective
AFCollectiveMember primaryMember = collective.FindPrimary();
if (primaryMember == null)
    throw new InvalidOperationException("Could not find primary.");
primaryMember.Description = "The Primary Member";
AFCollectiveMember secondaryMember = collective.Members.Add(secondary);
secondaryMember.Description = "The Secondary Member";
collective.ApplyChanges();

// Initialize replication of the database on the primary
primaryMember.StartReplication();

// Wait until the primary is ready before starting replication
//  on the secondaries.
collective.Refresh();
while (primaryMember.SyncStatus != AFSyncStatus.NoConfiguredSubscriptions)
{
    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(30));
    collective.Refresh();
}

// Initialize replication of the database on the secondaries
foreach (AFCollectiveMember member in collective.Members)
{
    if (member.ServerRole != AFServerRole.Primary)
        member.StartReplication();
}

// Display Collective Information
Console.WriteLine("Name of Collective = {0}", primary.Name);
Console.WriteLine("Description = {0}", primary.Description);
foreach (AFCollectiveMember CurMember in primary.Collective.Members)
{
    Console.WriteLine("  Name of Member = {0}", CurMember.Name);
    Console.WriteLine("  Description = {0}", CurMember.Description);
    Console.WriteLine("  IsAvailable = {0}", CurMember.IsAvailable);
    Console.WriteLine();
}
' This example demonstrates how to create and remove a collective.

' Add the PISystem to be used as the primary
Dim myPISystems As New PISystems
Dim primary As PISystem = myPISystems.Add(primaryName)
primary.Connect()

' Check if primary is already a collective
If primary.Collective IsNot Nothing Then
    Throw New InvalidOperationException(String.Format("Primary '{0}' is already a collective.", primary.Name))
End If

' Add the PISystem to be used as the secondary
Dim secondary As PISystem = myPISystems.Add(secondaryName)
secondary.Connect()

' Check if secondary is already a collective
If secondary.Collective IsNot Nothing Then
    Throw New InvalidOperationException(String.Format("Secondary '{0}' is already a collective.", secondary.Name))
End If

' Create the collective
Dim collective As AFCollective = primary.CreateCollective()
primary.Name = "Test-Collective"           ' Change the collective name
primary.Description = "The Collective"     ' Change the collective description

' Add members to the collective
Dim primaryMember As AFCollectiveMember = collective.FindPrimary()
If (primaryMember Is Nothing) Then
    Throw New InvalidOperationException("Could not find primary.")
End If
primaryMember.Description = "The Primary Member"
Dim secondaryMember As AFCollectiveMember = collective.Members.Add(secondary)
secondaryMember.Description = "The Secondary Member"
collective.ApplyChanges()

' Initialize replication of the database on the primary
primaryMember.StartReplication()

' Wait until the primary is ready before starting replication
'  on the secondaries.
collective.Refresh()
While (primaryMember.SyncStatus <> AFSyncStatus.NoConfiguredSubscriptions)
    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(30))
    collective.Refresh()
End While

' Initialize replication of the database on the secondaries
For Each member As AFCollectiveMember In collective.Members
    If (member.ServerRole <> AFServerRole.Primary) Then
        member.StartReplication()
    End If
Next

' Display Collective Information
Console.WriteLine("Name of Collective = {0}", primary.Name)
Console.WriteLine("Description = {0}", primary.Description)
For Each CurMember As AFCollectiveMember In primary.Collective.Members
    Console.WriteLine("  Name of Member = {0}", CurMember.Name)
    Console.WriteLine("  Description = {0}", CurMember.Description)
    Console.WriteLine("  IsAvailable = {0}", CurMember.IsAvailable)
    Console.WriteLine()
Next

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK


See Also

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