AFAttributeList.Add Method (String, AFObject)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Retrieves the AFAttribute object identified by the path string and
adds it to the collection.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public AFAttribute Add( string path, AFObject relativeFrom )
Public Function Add ( path As String, relativeFrom As AFObject ) As AFAttribute Dim instance As AFAttributeList Dim path As String Dim relativeFrom As AFObject Dim returnValue As AFAttribute returnValue = instance.Add(path, relativeFrom)
public: AFAttribute^ Add( String^ path, AFObject^ relativeFrom )
member Add : path : string * relativeFrom : AFObject -> AFAttribute
Parameters
- path
- Type: SystemString
A string containing a path name that is relative to the specified object, a fully qualified path, or a dynamic attribute path. - relativeFrom
- Type: OSIsoft.AFAFObject
Specifies the object that the paths may be relative to. For dynamic attributes, this parameter must indicate an AFDatabase or the dynamic attribute will not be associated with an AFDatabase.
Return Value
Type: AFAttributeReturns the AFAttribute identified by the path.
Remarks
A path to the AFAttribute can be obtained by calling one of the GetPath Overload methods.
This method is similar to the FindObject(String) method, but will only resolve object paths to an AFAttribute. When the path only indicates a path to an element, this routine will return the DefaultAttribute of that element. See Path Syntax for a complete description of the path syntax.
| If the specified path is a dynamic PIPoint path, this method will validate that the PIPoint exists. The AFAttribute(AFDatabase, String) constructor with a path parameter will not validate that the PIPoint exists. |
| The ShowExcludedAttributes setting will determine if excluded attributes are returned when finding attributes by path. |