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

Inheritance Hierarchy
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class PIServer : AFObject, IAFTimeSource, IAFChangedEvent, ISerializable, IPIPersist, IComparable<PIServer>, IEquatable<PIServer>
<SerializableAttribute> Public NotInheritable Class PIServer Inherits AFObject Implements IAFTimeSource, IAFChangedEvent, ISerializable, IPIPersist, IComparable(Of PIServer), IEquatable(Of PIServer) Dim instance As PIServer
[SerializableAttribute] public ref class PIServer sealed : public AFObject, IAFTimeSource, IAFChangedEvent, ISerializable, IPIPersist, IComparable<PIServer^>, IEquatable<PIServer^>
[<SealedAttribute>] [<SerializableAttribute>] type PIServer = class inherit AFObject interface IAFTimeSource interface IAFChangedEvent interface ISerializable interface IPIPersist interface IComparable<PIServer> interface IEquatable<PIServer> end
The PIServer type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| AliasNames |
The list of alias names for the PIServer.
| |
| AuthenticationMode |
Read-only property that returns the supported Authentication Modes of the .
| |
| Collective |
This property returns information and status about the PIServer collective.
| |
| ConnectionInfo |
This property returns information about the connection to the PIServer from
the local computer.
| |
| CurrentUserIdentities |
Gets the list of PIIdentity identities of the person who is currently
logged on to the PIServer server.
| |
| CurrentUserIdentityString |
Gets the security identity string of the person who is currently logged on to the PIServer server.
| |
| CurrentUserName |
Gets the user name of the person who is currently logged on to the PIServer server.
| |
| DatabaseSecurities |
This is the PIDatabaseSecurity collection of the PIServer.
| |
| DefaultAuthenticationMode |
Returns AFAuthenticationMode shared by parent collection.
| |
| Description |
Read/write property that provides a more detailed description of the object.
| |
| 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.) | |
| Identities |
This is the PIIdentity collection of the PIServer.
| |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IdentityMappings |
This is the PIIdentityMapping collection of the PIServer.
| |
| IdentityServerAuthorizationEndpoint |
Read-only property that returns the Authorization Endpoint for the Identity Server for the .
Will match unless connecting to a different RSSO Server.
| |
| IdentityServerEndpointAddress |
Read-only property that returns the endpoint address for the Identity Server for the .
| |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| Name |
This property identifies the name of the PIServer.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| PointClasses |
This is the PIPointClass collection of the PIServer.
| |
| PointSources |
This is the PIPointSource collection of the PIServer.
| |
| ServerTime |
Gets the current time of the PI Data Archive.
| |
| ServerTimeZone |
Gets the current time zone of the PI Data Archive.
| |
| ServerVersion |
Read-only property that contains a string that uniquely identifies the current
server version.
| |
| StateSets |
This is the collection of PI Digital State Sets on the PIServer represented
as a collection of AFEnumerationSet | |
| UniqueID |
Read-only property that provides the PIServer's unique identifier as a String.
(Overrides AFObjectUniqueID.) | |
| UsingDefaultAuthenticationMode |
Returns true if PISystem is using the default shared AFAuthenticationMode |
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(Boolean) |
Open a connection to the PI Data Archive using default credentials
to allow sending and retrieving data.
| |
| Connect(NetworkCredential) |
Open a connection to the PI Data Archive using the specified PI User credentials
to allow sending and retrieving data.
| |
| Connect(String) |
Connects to the server using the specified Access Token to allow sending and retrieving data.
| |
| Connect(AFConnectionPreference) |
Open a connection to the PI Data Archive using the specified connection preference
to allow sending and retrieving data.
| |
| Connect(Boolean, IWin32Window) |
Open a connection to the PI Data Archive with a credential prompt if necessary
to allow sending and retrieving data.
| |
| Connect(NetworkCredential, AFConnectionPreference) |
Open a connection to the PI Data Archive using the specified PI User credentials
and connection preference to allow sending and retrieving data.
| |
| Connect(NetworkCredential, PIAuthenticationMode) |
Open a connection to the PI Data Archive using the specified credentials
to allow sending and retrieving data.
| |
| Connect(String, AFConnectionPreference) |
Connects to the server using the specified Access Token to allow sending and retrieving data.
| |
| Connect(String, String) |
Connects to the server using the specified credentials to allow sending and retrieving data.
| |
| Connect(Boolean, IWin32Window, AFConnectionPreference) |
Open a connection to the PI Data Archive using the specified connection preference
with a credential prompt if necessary to allow sending and retrieving data.
| |
| Connect(NetworkCredential, AFConnectionPreference, PIAuthenticationMode) |
Open a connection to the PI Data Archive using the specified credentials
and connection preference to allow sending and retrieving data.
| |
| Connect(String, String, AFConnectionPreference) |
Connects to the server using the specified credentials to allow sending and retrieving data.
| |
| Connect(Boolean, IWin32Window, AFConnectionPreference, Boolean) |
Open a connection to the PI Data Archive using the specified connection preference
with a credential prompt if necessary to allow sending and retrieving data
and return an indication that dialog was canceled.
| |
| ConnectWithPrompt |
Connects to the server prompting for credentials.
| |
| ConnectWithPrompt(IWin32Window) |
Open a connection to the PI Data Archive prompting for credentials
to allow sending and retrieving data.
| |
| ConnectWithPrompt(AFConnectionPreference) |
Open a connection to the PI Data Archive prompting for credentials
to allow sending and retrieving data.
| |
| ConnectWithPrompt(IWin32Window, PIAuthenticationMode, NullableAFConnectionPreference) |
Open a connection to the PI Data Archive prompting for credentials
to allow sending and retrieving data.
| |
| CreatePIPoint |
Create a new PIPoint on the current PIServer.
| |
| CreatePIPoints(IDictionaryString, IDictionaryString, Object) |
Create a list of new PIPoint objects on the current PIServer with
each point having a different set of attribute values.
| |
| CreatePIPoints(IEnumerableString, IDictionaryString, Object) |
Create a list of new PIPoint objects on the current PIServer with
all points having the same attribute values.
| |
| DeletePIPoint |
Delete a PIPoint from the PIServer.
| |
| DeletePIPoints |
Delete a list of PIPoint objects from the PIServer.
| |
| Disconnect |
Close a connection to the PI Data Archive.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Overrides AFObjectEquals(Object).) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| Equals(PIServer) |
Indicates whether the current object is equal to another object of the same type.
| |
| ExportCsv(Object, IListObject, IListString, CultureInfo) |
Exports the CSV representation of requested object(s) and returns it as a string.
The supported objects include PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings.
| |
| ExportCsv(Object, IListObject, IListString, PIExportMode, CultureInfo) |
Exports the CSV representation of requested object(s) and returns it as a string.
The supported objects include PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings.
| |
| ExportCsv(Object, IListObject, IListString, CultureInfo, String, EventHandlerAFProgressEventArgs) |
Exports the representation of requested object(s) in comma-separated (CSV) format to a file.
The supported objects include PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings.
| |
| ExportCsv(Object, IListObject, IListString, PIExportMode, CultureInfo, String, EventHandlerAFProgressEventArgs) |
Exports the representation of requested object(s) in comma-separated (CSV) format to a file.
The supported objects include PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings.
| |
| FindChangedPIPoints |
Find all the PI Points that have changed in the PIServer.
| |
| FindPIServer(Guid) |
Find the PIServer from the specified unique identifier.
| |
| FindPIServer(String) |
Find the PIServer from the specified name.
| |
| FindPIServer(PISystem, Guid) |
Find the PIServer from the specified unique identifier using the credentials
of the current user associated with the specified PISystem.
| |
| FindPIServer(PISystem, String) |
Find the PIServer from the specified name using the credentials
of the current user associated with the specified PISystem.
| |
| GetAnnotations |
Gets the annotations associated with list of historical events.
| |
| GetBufferStatus |
This method gets the PIBufferStatus for the corresponding PIServer.
| |
| GetClientRpcMetrics |
Get the remote procedure call metrics to the server for this PIServer.
| |
| GetCsvColumns(Type, Boolean) |
Retrieve a collection containing the required and optional CSV columns for the specified
object type and its children.
The supported objects include PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings.
| |
| GetCsvColumns(Type, IListObject, Boolean) |
Retrieve a collection containing the required and optional CSV columns for the specified
object type and its children.
The supported objects include PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings.
| |
| 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 AFObjectGetHashCode.) | |
| GetIdentityServerBestRsso |
Method to retrieve the Best Redundant Single Sign-On Server Endpoint for the Identity Server for the .
| |
| 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.) | |
| GetPointAttributeNames |
Get the list of PIPoint attributes names for the PIServer.
| |
| GetPointCount |
This method gets the total point count for the corresponding PIServer.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| ImportCsv(PIImportMode, CultureInfo, Stream, EventHandlerAFProgressEventArgs) |
Imports the comma-separated value (CSV) representation of PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings
from a stream.
| |
| ImportCsv(PIImportMode, CultureInfo, String, EventHandlerAFProgressEventArgs) |
Imports the comma-separated value (CSV) representation of PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings
from a file.
| |
| LogOut |
Logs out the current OIDC user and closes all associated connections to the PI Data Archive.
| |
| Persist |
This method returns the persistence string for the object.
(Overrides AFObjectPersist.) | |
| Refresh |
Refresh the cached information for the PIServer.
| |
| RefreshOIDCToken |
Refreshes OIDC token on the PI Data Archive.
New access token to refresh the connection; if null, will try refresh token if available.
This exception will be generated if newAccessToken and refresh token are both unavailable.
| |
| ReplaceValues(AFTimeRange, IListAFValues) |
This method removes existing data within the specified AFTimeRange and
inserts the specified values.
| |
| ReplaceValues(AFTimeRange, IListAFValues, AFBufferOption) |
This method removes existing data within the specified AFTimeRange and
inserts the specified values.
| |
| Supports |
Checks if the specified PIServerFeature feature is supported by
the PIServer.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| TryConvertToServerID |
Convert a string key to a PIServer ID.
| |
| UpdateValues(IListAFValue, AFUpdateOption) | ||
| UpdateValues(IListAFValue, AFUpdateOption, AFBufferOption) | ||
| UpdateValuesAsync(IListAFValue, AFUpdateOption, CancellationToken) | ||
| UpdateValuesAsync(IListAFValue, AFUpdateOption, AFBufferOption, CancellationToken) |
Events
| Name | Description | |
|---|---|---|
| Changed |
Event is raised when the object or one of its sub-objects is changed.
| |
| ConnectChanged |
Occurs when the connection status of this PIServer changes.
|
Operators
| Name | Description | |
|---|---|---|
| Equality |
The equality operator (==) compares its operands to determine if they are equal.
| |
| Inequality |
The inequality operator (!=) compares its operands to determine if they are not equal.
|
Fields
| Name | Description | |
|---|---|---|
| SelectedAuthenticationMode |
Get the PIAuthenticationMode used to connect to the PI Server
|
Remarks
The PIServer object manages the connection to a PI Data Archive and provides access to the basic entities represented on each PI Data Archive. Use one of the FindPIServer Overload methods to obtain a PIServer object.
Typically a program will require a network connection to the PI Data Archive. Connections are established either by calling one of the Connect Overload methods explicitly, or by accessing a property or calling a method that requires server access.
| This method, property, or class is not available in the legacy .NET 3.5 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";
Dim myPIServers As New PIServers() ' Display information for Default PIServer Dim myConnectionInfo As PIConnectionInfo = 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 For Each server As PIServer In myPIServers Console.WriteLine(" Name of PIServer = {0}", server.Name) If server.UniqueID <> "" Then Console.WriteLine(" UniqueID of PIServer = {0}", server.UniqueID) Else Console.WriteLine(" UniqueID of PIServer = n/a") End If If server.ServerVersion <> "" Then Console.WriteLine(" Version of PIServer = {0}", server.ServerVersion) Else Console.WriteLine(" Version of PIServer = n/a") End If Console.WriteLine() Next ' Get the PIServer on the specified computer Dim myPIServer As PIServer = 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") IsNot Nothing Then myPIServers.Remove("NewPIServer") End If ' Add a new PIServer without validating host address PIServers.DirectoryOptions = PISystems.AFDirectoryOptions.None Dim newPIServer As PIServer = myPIServers.Add("NewPIServer") newPIServer.ConnectionInfo.Host = "NewHostAddress"
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.