Click or drag to resize
OSIsoft, LLC

PIServer Class

The PIServer object represents a single PI Data Archive.

Inheritance Hierarchy

Namespace:  OSIsoft.AF.PI
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.6.195
Syntax
[SerializableAttribute]
public sealed class PIServer : AFObject, 
	IAFTimeSource, IAFChangedEvent, ISerializable, IPIPersist, IComparable<PIServer>, 
	IEquatable<PIServer>

The PIServer type exposes the following members.

Properties
  NameDescription
Public propertyAliasNames
The list of alias names for the PIServer.
Public propertyCollective
This property returns information and status about the PIServer collective.
Public propertyConnectionInfo
This property returns information about the connection to the PIServer from the local computer.
Public propertyCurrentUserIdentities
Gets the list of PIIdentity identities of the person who is currently logged on to the PIServer server.
Public propertyCurrentUserIdentityString
Gets the security identity string of the person who is currently logged on to the PIServer server.
Public propertyCurrentUserName
Gets the user name of the person who is currently logged on to the PIServer server.
Public propertyDatabaseSecurities
This is the PIDatabaseSecurity collection of the PIServer.
Public propertyDescription
Read/write property that provides a more detailed description of the object.
Public propertyID
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 propertyIdentities
This is the PIIdentity collection of the PIServer.
Public propertyIdentity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public propertyIdentityMappings
This is the PIIdentityMapping collection of the PIServer.
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyName
This property identifies the name of the PIServer.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertyPointClasses
This is the PIPointClass collection of the PIServer.
Public propertyPointSources
This is the PIPointSource collection of the PIServer.
Public propertyServerTime
Gets the current time of the PI Data Archive.
Public propertyServerTimeZone
Gets the current time zone of the PI Data Archive.
Public propertyServerVersion
Read-only property that contains a string that uniquely identifies the current server version.
Public propertyStateSets
This is the collection of PI Digital State Sets on the PIServer represented as a collection of AFEnumerationSet
Public propertyUniqueID
Read-only property that provides the PIServer's unique identifier as a String.
(Overrides AFObjectUniqueID.)
Top
Methods
  NameDescription
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodCode exampleConnect(Boolean)
Open a connection to the PI Data Archive using default credentials to allow sending and retrieving data.
Public methodCode exampleConnect(NetworkCredential)
Open a connection to the PI Data Archive using the specified PI User credentials to allow sending and retrieving data.
Public methodCode exampleConnect(Boolean, IWin32Window)
Open a connection to the PI Data Archive with a credential prompt if necessary to allow sending and retrieving data.
Public methodCode exampleConnect(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.
Public methodCode exampleConnect(NetworkCredential, PIAuthenticationMode)
Open a connection to the PI Data Archive using the specified credentials to allow sending and retrieving data.
Public methodCode exampleConnect(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.
Public methodCode exampleConnect(NetworkCredential, AFConnectionPreference, PIAuthenticationMode)
Open a connection to the PI Data Archive using the specified credentials and connection preference to allow sending and retrieving data.
Public methodCode exampleConnect(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.
Public methodCode exampleConnectWithPrompt
Open a connection to the PI Data Archive prompting for credentials to allow sending and retrieving data.
Public methodCreatePIPoint
Create a new PIPoint on the current PIServer.
Public methodCreatePIPoints(IDictionaryString, IDictionaryString, Object)
Create a list of new PIPoint objects on the current PIServer with each point having a different set of attribute values.
Public methodCreatePIPoints(IEnumerableString, IDictionaryString, Object)
Create a list of new PIPoint objects on the current PIServer with all points having the same attribute values.
Public methodDeletePIPoint
Delete a PIPoint from the PIServer.
Public methodDeletePIPoints
Delete a list of PIPoint objects from the PIServer.
Public methodDisconnect
Close a connection to the PI Data Archive.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Overrides AFObjectEquals(Object).)
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodEquals(PIServer)
Indicates whether the current object is equal to another object of the same type.
Public methodExportCsv(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.
Public methodExportCsv(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.
Public methodExportCsv(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.
Public methodExportCsv(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.
Public methodCode exampleFindChangedPIPoints
Find all the PI Points that have changed in the PIServer.
Public methodStatic memberFindPIServer(Guid)
Find the PIServer from the specified unique identifier.
Public methodStatic memberFindPIServer(String)
Find the PIServer from the specified name.
Public methodStatic memberFindPIServer(PISystem, Guid)
Find the PIServer from the specified unique identifier using the credentials of the current user associated with the specified PISystem.
Public methodStatic memberFindPIServer(PISystem, String)
Find the PIServer from the specified name using the credentials of the current user associated with the specified PISystem.
Public methodGetAnnotations
Gets the annotations associated with list of historical events.
Public methodGetBufferStatus
This method gets the PIBufferStatus for the corresponding PIServer.
Public methodGetClientRpcMetrics
Get the remote procedure call metrics to the server for this PIServer.
Public methodGetCsvColumns(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.
Public methodGetCsvColumns(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.
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 AFObjectGetHashCode.)
Public methodGetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public methodGetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public methodGetPath(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 methodGetPointAttributeNames
Get the list of PIPoint attributes names for the PIServer.
Public methodGetPointCount
This method gets the total point count for the corresponding PIServer.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodImportCsv(PIImportMode, CultureInfo, Stream, EventHandlerAFProgressEventArgs)
Imports the comma-separated value (CSV) representation of PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings from a stream.
Public methodImportCsv(PIImportMode, CultureInfo, String, EventHandlerAFProgressEventArgs)
Imports the comma-separated value (CSV) representation of PI Points, PI DigitalStateSets, PI Identities, or PI IdentityMappings from a file.
Public methodPersist
This method returns the persistence string for the object.
(Overrides AFObjectPersist.)
Public methodRefresh
Refresh the cached information for the PIServer.
Public methodReplaceValues(AFTimeRange, IListAFValues)
This method removes existing data within the specified AFTimeRange and inserts the specified values.
Public methodReplaceValues(AFTimeRange, IListAFValues, AFBufferOption)
This method removes existing data within the specified AFTimeRange and inserts the specified values.
Public methodSupports
Checks if the specified PIServerFeature feature is supported by the PIServer.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public methodStatic memberTryConvertToServerID
Convert a string key to a PIServer ID.
Public methodUpdateValues(IListAFValue, AFUpdateOption)
Update, write or delete the PIPoint value for each AFValue in the specified list.
Public methodCode exampleUpdateValues(IListAFValue, AFUpdateOption, AFBufferOption)
Update the PIPoint value for each AFValue in the specified list.
Public methodUpdateValuesAsync(IListAFValue, AFUpdateOption, CancellationToken)
Update the PIPoint value for each AFValue in the specified list.
Public methodUpdateValuesAsync(IListAFValue, AFUpdateOption, AFBufferOption, CancellationToken)
Update the PIPoint value for each AFValue in the specified list.
Top
Events
  NameDescription
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Public eventCode exampleConnectChanged
Occurs when the connection status of this PIServer changes.
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
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 or ConnectWithPrompt(IWin32Window) methods explicitly, or by accessing a property or calling a method that requires server access.

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