Click or drag to resize
OSIsoft, LLC

PIServers Class

The global collection of PIServer objects that represents the known PI Data Archive servers available from a workstation for client applications.

Inheritance Hierarchy
SystemObject
  OSIsoft.AF.PIPIServers

Namespace:  OSIsoft.AF.PI
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntax
public sealed class PIServers : IList<PIServer>, 
	ICollection<PIServer>, IEnumerable<PIServer>, IEnumerable, 
	IAFList, IList, ICollection, IAFChangedEvent

The PIServers type exposes the following members.

Constructors
  NameDescription
Public methodPIServers
Initializes a new instance of the PIServers collection.
Top
Properties
  NameDescription
Public propertyStatic memberAuthenticationOptions
The authentication options used when making a connection to a PIServer.
Public propertyCount
Gets the number of items actually contained in the collection.
Public propertyDefaultPIServer
The default PIServer configured for the current client machine.
Public propertyStatic memberDirectoryOptions
The directory options used when looking up a PIServer in the collection.
Public propertyIdentity
This read-only property contains identity of the object.
Public propertyItemGuid
Gets the item with the specified id.
Public propertyItemInt32
Gets or sets the item at the specified index.
Public propertyItemString
Returns the specified object from the collection by name.
Top
Methods
  NameDescription
Public methodAdd
Registers a new PIServer to the list of known servers on the local machine.
Public methodClear
Unregisters all existing PIServer entries from the list of known PI Data Archive servers on the local machine.
Public methodContains(Guid)
This method determines whether the collection contains a specific item referenced by id.
Public methodContains(String)
This method determines whether the collection contains a specific item referenced by name.
Public methodContains(PIServer)
This method determines whether the collection contains a specific item.
Public methodCopyTo
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array.
Public methodDisconnectAll
Disconnects all PIServers that are currently connected.
Public methodEquals
Determines whether the specified Object is equal to the current object.
(Overrides ObjectEquals(Object).)
Public methodGetBufferStatus
This method gets the PIBufferStatus of the PI Buffer Subsystem.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodGetHashCode
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 methodStatic memberGetPIServers
Get the list of known PIServers on the local machine.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.
Public methodRefresh
Refresh the list of known PI Data Archive servers on the local machine, where the cached collections of connected servers will be refreshed.
Public methodRefresh(Boolean)
Refresh the list of known PI Data Archive servers on the local machine with the option to refresh cached collections for connected servers.
Public methodRemove(Guid)
Unregisters an existing PIServer with the specified unique identifier.
Public methodRemove(String)
Unregisters an existing PIServer with the specified name.
Public methodRemove(PIServer)
Unregisters the specified PIServer.
Public methodRemoveAt
Unregisters an existing PIServer by removing the entry from the list of known PI Data Archive servers on the local machine.
Public methodSort
Sorts the items in the entire collection using the default comparer.
Public methodSort(IComparerPIServer)
Sorts the items in the entire collection using the specified comparer.
Public methodSort(Int32, Int32, IComparerPIServer)
Sorts the items in a range of items in the collection using the specified comparer.
Public methodToString
Returns a String that represents the current object.
(Overrides ObjectToString.)
Top
Events
  NameDescription
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Public eventCode exampleConnectFailed
Occurs when the connection to a PIServer fails and not performing an auto prompt.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
The equality operator (==) compares its operands to determine if they are equal.
Public operatorStatic memberInequality
The inequality operator (!=) compares its operands to determine if they are not equal.
Top
Extension Methods
  NameDescription
Public Extension MethodAggregatePIServer
Performs all requested aggregates on the specified items.
(Defined by AFAggregate.)
Public Extension MethodAggregateAsyncPIServer
Performs all requested aggregates on the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodBinnedSummaryPIServer, TBin
Generates a summary broken down by the specified bins for items matching the search criteria.
(Defined by AFAggregate.)
Public Extension MethodBinnedSummaryAsyncPIServer, TBin
Generates a summary broken down by the specified bins for items matching the search criteria asynchronously.
(Defined by AFAggregate.)
Public Extension MethodCode exampleChunkedByPIServer
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 MethodFrequencyDistributionPIServer
Generates a frequency distribution for the specified items.
(Defined by AFAggregate.)
Public Extension MethodFrequencyDistributionAsyncPIServer
Generates a frequency distribution for the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodGroupedSummaryPIServer
Generates a summary broken down by group for the specified items.
(Defined by AFAggregate.)
Public Extension MethodGroupedSummaryAsyncPIServer
Generates a histogram for the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodHistogramPIServer, TBin
Generates a histogram for the specified items with the specified weighting.
(Defined by AFAggregate.)
Public Extension MethodHistogramAsyncPIServer, TBin
Generates a histogram for the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.)
Public Extension MethodSummaryPIServer(String, AFSummaryTypes)Overloaded.
Summarizes the specified items.
(Defined by AFAggregate.)
Public Extension MethodSummaryPIServer(String, AFSummaryTypes, String)Overloaded.
Summarizes the specified items with the specified weighting.
(Defined by AFAggregate.)
Public Extension MethodSummaryAsyncPIServer(String, AFSummaryTypes, CancellationToken)Overloaded.
Summarizes the specified items asynchronously.
(Defined by AFAggregate.)
Public Extension MethodSummaryAsyncPIServer(String, AFSummaryTypes, String, CancellationToken)Overloaded.
Summarizes the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.)
Top
Remarks
This is the list of known PIServers on the workstation for client applications. This list of PIServers can be manipulated with the methods of this object. For example, the Add(String) method is used to add a PIServer to this workstation. This allows the client to connect to an existing PIServer that was previously installed on the network. The DirectoryOptions controls the behavior when looking up items in the collection.

Note Notes to Callers
This method, property, or class is only available in the .NET 4 version of the SDK.

Examples
PIServers myPIServers = new PIServers();

// Display information for Default PIServer
PIConnectionInfo myConnectionInfo = myPIServers.DefaultPIServer.ConnectionInfo;
Console.WriteLine("Name of Default PIServer = {0}", myPIServers.DefaultPIServer.Name);
Console.WriteLine("Host used to connect to Default PIServer = {0}", myConnectionInfo.Host);
Console.WriteLine("Port used to connect to Default PIServer = {0}", myConnectionInfo.Port);
Console.WriteLine();

// Display the number of PIServers
Console.WriteLine("PIServer count = {0}", myPIServers.Count);

// Display PIServer information
foreach (PIServer server in myPIServers)
{
    Console.WriteLine("   Name of PIServer = {0}", server.Name);
    if (server.UniqueID != "")
        Console.WriteLine("   UniqueID of PIServer = {0}", server.UniqueID);
    else
        Console.WriteLine("   UniqueID of PIServer = n/a");
    if (server.ServerVersion != "")
        Console.WriteLine("   Version of PIServer = {0}", server.ServerVersion);
    else
        Console.WriteLine("   Version of PIServer = n/a");
    Console.WriteLine();
}

// Get the PIServer on the specified computer
PIServer myPIServer = PIServer.FindPIServer(piServerName);

// Display information about the PIServer
Console.WriteLine("Name of the local PIServer = {0}", myPIServer.Name);
Console.WriteLine("ID of the PIServer = {0}", myPIServer.ID);
Console.WriteLine("PIServer Current Time = {0}", myPIServer.ServerTime);
Console.WriteLine("PIServer TimeZone = {0}", myPIServer.ServerTimeZone);
Console.WriteLine();

// Remove PIServer if it exists
if (myPIServers["NewPIServer"] != null)
{
    myPIServers.Remove("NewPIServer");
}

// Add a new PIServer without validating host address
PIServers.DirectoryOptions = PISystems.AFDirectoryOptions.None;
PIServer newPIServer = myPIServers.Add("NewPIServer");
newPIServer.ConnectionInfo.Host = "NewHostAddress";
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5
See Also
Enabling Operational Intelligence