AFGlobalRestorer.RestoreServers Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static Dictionary<string, Object> RestoreServers( string persistenceData, IList<Exception> errors, Dictionary<string, Object> context )
Public Shared Function RestoreServers ( persistenceData As String, errors As IList(Of Exception), context As Dictionary(Of String, Object) ) As Dictionary(Of String, Object) Dim persistenceData As String Dim errors As IList(Of Exception) Dim context As Dictionary(Of String, Object) Dim returnValue As Dictionary(Of String, Object) returnValue = AFGlobalRestorer.RestoreServers(persistenceData, errors, context)
public: static Dictionary<String^, Object^>^ RestoreServers( String^ persistenceData, IList<Exception^>^ errors, Dictionary<String^, Object^>^ context )
static member RestoreServers : persistenceData : string * errors : IList<Exception> * context : Dictionary<string, Object> -> Dictionary<string, Object>
Parameters
- persistenceData
- Type: SystemString
The persistence string that was obtained from the original object using the IPIPersist interface. - errors
- Type: System.Collections.GenericIListException
A list of Exception objects containing exceptions encountered when restoring the servers. Pass if you are not interested in having the errors returned. - context
- Type: System.Collections.GenericDictionaryString, Object
A DictionaryTKey, TValue containing context variables. If you do not need to specify any context, then is allowed.
Return Value
Type: DictionaryString, ObjectReturns a DictionaryTKey, TValue of the servers in the persistence string. The Key of each dictionary item is the server name. The Value is the Server object.
If an error occurs, the returned errors list contains the Exception for the error.
Remarks
This method uses other objects that implement the IPIRestorer interface to build the collection of servers specified in the persistence string.
The context parameter contains a dictionary of context variables to assist in restoring the servers from the persistence string. The Key of each dictionary item in the collection is the context variable name. The Value is the context variable value. The following table lists the supported context variable names and their values:
| Name | Value |
|---|---|
| SDK | PI SDK object. You should pass this if you want to use a PI SDK object other than the one associated with your thread. |
| Server | PIServer object. You should pass this if you want to override the PIServer in the persistence string. |
| PreferName | Pass this with a value of if you want to prefer the name for objects (like Server and PIPoint) that have both the name and the ID stored in the persistence string. |
| QueryDate | Pass this to retrieve a specific value of an object. The value at or before the QueryDate will be returned. If this variable is not passed, the current value of the object will be restored. |