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

AF SDK Reference

PISystems Class

  • Last UpdatedNov 18, 2025
  • 12 minute read
PISystems Class
The global collection of PISystem objects maintained by the AF SDK represents the known systems available from a workstation for client applications.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFPISystems

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

Syntax

public sealed class PISystems : IList<PISystem>, 
	ICollection<PISystem>, IEnumerable<PISystem>, IEnumerable, 
	IAFList, IList, ICollection, IAFChangedEvent
Public NotInheritable Class PISystems
	Implements IList(Of PISystem), ICollection(Of PISystem), 
	IEnumerable(Of PISystem), IEnumerable, IAFList, IList, 
	ICollection, IAFChangedEvent

Dim instance As PISystems
public ref class PISystems sealed : IList<PISystem^>, 
	ICollection<PISystem^>, IEnumerable<PISystem^>, IEnumerable, 
	IAFList, IList, ICollection, IAFChangedEvent
[<SealedAttribute>]
type PISystems =  
    class
        interface IList<PISystem>
        interface ICollection<PISystem>
        interface IEnumerable<PISystem>
        interface IEnumerable
        interface IAFList
        interface IList
        interface ICollection
        interface IAFChangedEvent
    end

The PISystems type exposes the following members.

Constructors

  NameDescription
Public method
PISystems
Initializes a new instance of the PISystems collection.
Public method
PISystems(Boolean)
Initializes a new instance of the PISystems collection with an option to create an independent cache.
Public methodCode example
PISystems(ClaimsIdentity, Boolean)
Initializes a new instance of the PISystems collection with for the ClaimsIdentity user with an option to create an independent cache.
Public methodCode example
PISystems(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.

Properties

  NameDescription
Public property
Count
Gets the number of items actually contained in the collection.
Public property
CurrentUserId
Gets the Id for the PISystems current identity.
Public property
CurrentUserName
Gets the name for the PISystems current identity.
Public property
DefaultPISystem
The default PISystem configured in the AF SDK.
Public propertyStatic member
DirectoryOptions
The directory options used when looking up a PISystem in the collection.
Public property
Identity
This read-only property contains identity of the object.
Public property
ItemGuid
Gets the item with the specified id.
Public property
ItemInt32
Gets or sets the item at the specified index.
Public property
ItemString
Returns the specified object from the collection by name.
Public property
Version
Read-only property contains a string that uniquely identifies the current client version of the SDK.

Methods

  NameDescription
Public method
Add
Registers a new PISystem to the list of known systems on the local machine.
Public method
Clear
Unregisters all existing PISystem entries from the list of known PISystems on the local machine.
Public method
Contains(Guid)
This method determines whether the collection contains a specific item referenced by id.
Public method
Contains(String)
This method determines whether the collection contains a specific item referenced by name.
Public method
CopyTo
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array.
Public method
DisconnectAll
Disconnects all PISystems that are currently connected.
Public method
Equals
Determines whether the specified Object is equal to the current object.
(Overrides ObjectEquals(Object).)
Public method
GetEnumerator
Returns an enumerator that iterates through the collection.
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.
(Overrides ObjectGetHashCode.)
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
IndexOf
Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.
Public method
Refresh
Refresh the collection to the list of known systems on the local machine including disconnected systems.
Public method
Refresh(Boolean)
Refresh the collection to the list of known systems on the local machine with the option to refresh only connected systems.
Public method
Refresh(Boolean, Boolean)
Refresh the collection to the list of known systems on the local machine with the option to refresh only connected systems and/or database-level objects.
Public method
Remove(Guid)
Unregisters an existing PISystem with the specified unique identifier.
Public method
Remove(String)
Unregisters an existing PISystem with the specified name.
Public method
Remove(PISystem)
Unregisters the specified PISystem.
Public method
RemoveAt
Unregisters an existing PISystem by removing the entry from the list of known PISystems on the local machine.
Public method
SetApplicationIdentity
Set the client application identity to identify an application to the servers to which it connects.
Public method
Sort
Sorts the items in the entire collection using the default comparer.
Public method
Sort(IComparerPISystem)
Sorts the items in the entire collection using the specified comparer.
Public method
Sort(Int32, Int32, IComparerPISystem)
Sorts the items in a range of items in the collection using the specified comparer.
Public method
ToString
Returns a String that represents the current object.
(Overrides ObjectToString.)

Events

  NameDescription
Public eventCode example
Changed
Event is raised when the object or one of its sub-objects is changed.

Operators

  NameDescription
Public operatorStatic member
Equality
The equality operator (==) compares its operands to determine if they are equal.
Public operatorStatic member
Inequality
The inequality operator (!=) compares its operands to determine if they are not equal.

Extension Methods

  NameDescription
Public Extension Method
AggregatePISystem
Performs all requested aggregates on the specified items.
(Defined by AFAggregate.)
Public Extension Method
AggregateAsyncPISystem
Performs all requested aggregates on the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension Method
BinnedSummaryPISystem, TBin
Generates a summary broken down by the specified bins for items matching the search criteria.
(Defined by AFAggregate.)
Public Extension Method
BinnedSummaryAsyncPISystem, TBin
Generates a summary broken down by the specified bins for items matching the search criteria asynchronously.
(Defined by AFAggregate.)
Public Extension MethodCode example
ChunkedByPISystem
This extension method breaks up search results into chunks to make it easier to page through and process IEnumerableT collections in chunks.
(Defined by AFSDKExtension.)
Public Extension Method
FrequencyDistributionPISystem
Generates a frequency distribution for the specified items.
(Defined by AFAggregate.)
Public Extension Method
FrequencyDistributionAsyncPISystem
Generates a frequency distribution for the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension Method
GroupedSummaryPISystem
Generates a summary broken down by group for the specified items.
(Defined by AFAggregate.)
Public Extension Method
GroupedSummaryAsyncPISystem
Generates a histogram for the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension Method
HistogramPISystem, TBin
Generates a histogram for the specified items with the specified weighting.
(Defined by AFAggregate.)
Public Extension Method
HistogramAsyncPISystem, TBin
Generates a histogram for the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.)
Public Extension Method
SummaryPISystem(String, AFSummaryTypes)Overloaded.
Summarizes the specified items.
(Defined by AFAggregate.)
Public Extension Method
SummaryPISystem(String, AFSummaryTypes, String)Overloaded.
Summarizes the specified items with the specified weighting.
(Defined by AFAggregate.)
Public Extension Method
SummaryAsyncPISystem(String, AFSummaryTypes, CancellationToken)Overloaded.
Summarizes the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension Method
SummaryAsyncPISystem(String, AFSummaryTypes, String, CancellationToken)Overloaded.
Summarizes the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.)

Remarks

This is the list of known PISystems on the workstation for client applications. This list of PISystems can be manipulated with the methods of this object. For example, the Add(String) method is used to add a PISystem to this workstation. This allows the client to connect to an existing PISystem that was previously installed on the network. Each PISystem also maintains a list of alias or alternate names (see PISystem.AliasNames) that can be used to lookup the PISystem in this collection. The DirectoryOptions controls the behavior when looking up items in the collection.

The PISystems list, as well as other AF SDK configuration information is stored in the file AFSDK.config, found in the OSIsoft\AF sub-directory located in the common application directory (location varies by operating system). Note that if the AFSDK.config file is first found in the current user's roaming application directory (location varies by operating system), this file will be used instead, and all operations on the PI Systems list will be specific for this user only. Note there is no provision in the AF SDK for creating a per-user configuration file. The creation of this file must occur manually via the file system.

The PISystems collection is the top level of the AF SDK hierarchy. Most accesses to AF SDK objects start with a reference to this object. Multiple instances of this object can be created in an application, but all instances within the same application reference the same collection of PISystem objects. This means that within the same application, changes made to an object within a PISystem will be seen by all other instances of the PISystems object. Other applications will not see the changes until they have been saved to persistent storage. The DisconnectAll method should be called before the application exits.

When programming in a .NET managed language, you must add a reference to the OSIsoft.AFSDK assembly to the project (from the 'Project/References' menu item). AF SDK objects are located within the OSIsoft.AF namespace (for example, OSIsoft.AF.PISystem), or one of its sub-namespaces (for example, OSIsoft.AF.Asset.AFElement).

Examples

PISystems myPISystems = new PISystems();

// Display information for Default PISystem
AFConnectionInfo myConnectionInfo = myPISystems.DefaultPISystem.ConnectionInfo;
Console.WriteLine("Name of Default PISystem = {0}", myPISystems.DefaultPISystem.Name);
Console.WriteLine("Description of Default PISystem = {0}", myPISystems.DefaultPISystem.Description);
Console.WriteLine("Host used to connect to Default PISystem = {0}", myConnectionInfo.Host);
Console.WriteLine("Port used to connect to Default PISystem = {0}", myConnectionInfo.Port);
Console.WriteLine("Protocol used to connect to Default PISystem = {0}", myConnectionInfo.Protocol);
Console.WriteLine();

// Display the version of the PISystems
Console.WriteLine("Version of the PISystems = {0}", myPISystems.Version);

// Display the number of PISystems
Console.WriteLine("PISystem count = {0}", myPISystems.Count);

// Display PISystem information
foreach (PISystem sys in myPISystems)
{
    Console.WriteLine("   Name of PISystem = {0}", sys.Name);
    Console.WriteLine("   Description of PISystem = {0}", sys.Description);
    Console.WriteLine("   UniqueID of PISystem = {0}", sys.UniqueID);
    Console.WriteLine();
}

// Add a new PISystem
PISystem newSys = myPISystems.Add("NewPISystem");
newSys.ConnectionInfo.Host = "localhost";
Dim myPISystems As New PISystems()

' Display information for Default PISystem
Dim myConnectionInfo As AFConnectionInfo = myPISystems.DefaultPISystem.ConnectionInfo
Console.WriteLine("Name of Default PISystem = {0}", myPISystems.DefaultPISystem.Name)
Console.WriteLine("Description of Default PISystem = {0}", myPISystems.DefaultPISystem.Description)
Console.WriteLine("Host used to connect to Default PISystem = {0}", myConnectionInfo.Host)
Console.WriteLine("Port used to connect to Default PISystem = {0}", myConnectionInfo.Port)
Console.WriteLine("Protocol used to connect to Default PISystem = {0}", myConnectionInfo.Protocol)
Console.WriteLine()

' Display the version of the PISystems
Console.WriteLine("Version of the PISystems = {0}", myPISystems.Version)

' Display the number of PISystems
Console.WriteLine("PISystem count = {0}", myPISystems.Count)

' Display PISystem information
For Each sys As PISystem In myPISystems
    Console.WriteLine("   Name of PISystem = {0}", sys.Name)
    Console.WriteLine("   Description of PISystem = {0}", sys.Description)
    Console.WriteLine("   UniqueID of PISystem = {0}", sys.UniqueID)
    Console.WriteLine()
Next

' Add a new PISystem
Dim newSys As PISystem = myPISystems.Add("NewPISystem")
newSys.ConnectionInfo.Host = "localhost"

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