AFElements.Add Method (AFElement)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void Add( AFElement item )
Public Sub Add ( item As AFElement ) Dim instance As AFElements Dim item As AFElement instance.Add(item)
public: void Add( AFElement^ item )
member Add : item : AFElement -> unit
Parameters
- item
- Type: OSIsoft.AF.AssetAFElement
An existing object to be added to the collection.
Remarks
An existing AFElement is added to this collection using the default AFReferenceType, (Parent-Child).
There can only be a single hierarchical relationship between two elements. This means that you cannot insert an existing element into an elements collection that already contains that element. Only one reference between the AFDatabase and an AFElement is allowed and its AFReferenceStrength must be Strong. |
This method can also be used on the AFModel.Elements collection to add an existing AFElement object to the model. When first added to the model, the element is not connected to any other elements. Use one of the AFConnections.Add Overload methods to create a connection between two elements in the model.
When a reference is added to or removed from an element, the parent element is checked out in the client, but it is not actually checked out in the server. This allows elements to be added to or removed from the collection from multiple applications and then checked in without requiring a checkout lock on the parent element in the server. If any other change is made to the parent element, a full server checkout is performed. Calling ApplyChanges will also require a full server checkout to be performed before saving to the server.