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

AF SDK Reference

AFGlobalRestorer.RestoreObject Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFGlobalRestorer.RestoreObject Method
This method restores an object from the specified persistence string.

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

Syntax

public static Object RestoreObject(
	string persistenceData,
	Dictionary<string, Object> context
)
Public Shared Function RestoreObject ( 
	persistenceData As String,
	context As Dictionary(Of String, Object)
) As Object

Dim persistenceData As String
Dim context As Dictionary(Of String, Object)
Dim returnValue As Object

returnValue = AFGlobalRestorer.RestoreObject(persistenceData, 
	context)
public:
static Object^ RestoreObject(
	String^ persistenceData, 
	Dictionary<String^, Object^>^ context
)
static member RestoreObject : 
        persistenceData : string * 
        context : Dictionary<string, Object> -> Object 

Parameters

persistenceData
Type: SystemString
The persistence string that was obtained from the original object using the IPIPersist interface.j
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: Object
Returns the object restored from the persistence string.

Remarks

This method uses other objects that implement the IPIRestorer interface to restore the object from the specified persistence string.

The context parameter contains a dictionary of context variables to assist in restoring the object 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:

NameValue
SDKPI SDK object. You should pass this if you want to use a PI SDK object other than the one associated with your thread.
ServerPIServer object. You should pass this if you want to override the PIServer in the persistence string.
SystemsPISystems object. You should pass this if you want to use a PISystems collection other than the default collection associated with the current user identity.
SystemPISystem object. You should pass this if you want to override the PISystem in the persistence string.
DatabaseAFDatabase object. You should pass this if you want to override the AFDatabase in the persistence string.
PreferNamePass this with a value of if you want to prefer the name for objects (like PISystem, PIServer, AFElement, PIPoint, etc.) that have both the name and the ID stored in the persistence string.
QueryDatePass this to retrieve a specific version of an object. The version at or before the QueryDate will be returned. If this variable is not passed, the current version of the object will be restored.

Version Information

AFSDK


See Also

In This Topic
TitleResults for “How to create a CRG?”Also Available in