AFCollectiveMember Class
- Last UpdatedNov 18, 2025
- 10 minute read
- PI System
- AF SDK 2024 R2
- Developer

Inheritance Hierarchy
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
| Name | Description | |
|---|---|---|
| AccountName |
This property is the account name that the PI AF Server
for this AFCollectiveMember is executing under.
| |
| Collective |
The AFCollective that owns the collective member.
| |
| CommunicationsGracePeriod |
The communication grace period before the CommunicationStatus
is set to TimedOutOnPrimary when there has not
been any communication with the primary server.
| |
| CommunicationsPeriod |
The communication period that the collective members use to
determine each others status.
| |
| CommunicationStatus |
The status of the communication between the members of the collective.
| |
| CredentialsAccountName | Obsolete.
The account name used by the collective member to access primary server.
| |
| DatabaseVersion |
Read-only property that contains a string that uniquely identifies the current
database version.
| |
| Description |
Read/write property that provides a more detailed description of the object.
| |
| Host |
This property is the name of the host machine where the PI AF Server
for this AFCollectiveMember is executing.
| |
| 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.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IsAvailable |
Indicates if the collective member is available.
| |
| IsConnected |
Indicates if the collective member is being used as the connection to the PI AF Server.
| |
| IsConnectedToPrimary |
Indicates if the client is connected to the primary server within the collective.
| |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| LastCommunicationTime |
The last communication time to the primary server within the collective.
| |
| LastSyncTime |
The last synchronization time to the primary server within the collective.
| |
| Name |
Read/write property that identifies the name of the object.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| Port |
Read/write property that is the port number used to connect to the PI AF Server
for this AFCollectiveMember on the remote host.
| |
| Priority |
Indicates the priority order in which to select a collective member.
| |
| Protocol |
Read/write property that is the protocol used to connect to the PI AF Server for
this AFCollectiveMember on the remote host.
| |
| ServerRole |
The role of the collective member server within the AFCollective.
| |
| ServerVersion |
Read-only property that contains a string that uniquely identifies the current
server version.
| |
| 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.
| |
| SyncStatus |
The status of the synchronization between the members of the collective.
| |
| TimeOut |
Read/write property that is the connection timeout used to connect to the PI AF Server
for this AFCollectiveMember on the remote host.
| |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) |
Methods
| Name | Description | |
|---|---|---|
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| Connect |
Connects to the specific server within the AFCollective using default credentials
to allow sending and retrieving data.
| |
| Connect(NetworkCredential) |
Connects to the specific server within the AFCollective using the specified
credentials to allow sending and retrieving data.
| |
| Connect(Boolean, IWin32Window) |
Connects to the specific server within the AFCollective with a credential prompt
if necessary to allow sending and retrieving data.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFCollectiveMember) |
Indicates whether the current object is equal to another object of the same type.
| |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| 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.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| 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.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Persist |
This method returns the persistence string for the object.
(Inherited from AFObject.) | |
| ReinitializeReplication |
Reinitialize the collective member to replicate data between members.
| |
| SetCredentialsAccount | Obsolete.
Set the account used to by the collective member to access primary server.
| |
| StartReplication |
Initialize the collective member to start replication of data between members.
| |
| StopReplication |
Stop the collective member from replicating data between members.
| |
| 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.