AFVersion.Create Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Creates a new version of an object at the specified effective date.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public IAFVersionable Create( Object effectiveDate, string comment )
Public Function Create ( effectiveDate As Object, comment As String ) As IAFVersionable Dim instance As AFVersion Dim effectiveDate As Object Dim comment As String Dim returnValue As IAFVersionable returnValue = instance.Create(effectiveDate, comment)
public: IAFVersionable^ Create( Object^ effectiveDate, String^ comment )
member Create : effectiveDate : Object * comment : string -> IAFVersionable
Parameters
- effectiveDate
- Type: SystemObject
The date that the new version of the object goes into effect. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on AFTime.Now. - comment
- Type: SystemString
The comment for the new version of the object. The maximum length of this parameter is 1000 characters.
Return Value
Type: IAFVersionableReturns the newly created version of the owning object.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentException | An object version at the specified effectiveDate already exists. |
Remarks
This method creates a new instance of the existing object at the specified effective date. The newly created version has all properties set identical to the current version of owning object.
Use the PISystem.Supports method to check if the PISystem supports the Versioning feature.
| Creating a new version may cause the current object to become invalid because it no longer exists at the current query date. |