AFElement.FindElementsByExtendedProperty Method (AFDatabase, String, IEnumerable(String), Int32)
- Last UpdatedNov 18, 2025
- 4 minute read
- PI System
- AF SDK 2024 R2
- Developer
Retrieves a list of AFElement objects that have the specified extended property
string values defined for the element.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static IList<KeyValuePair<string, AFElement>> FindElementsByExtendedProperty( AFDatabase database, string propertyName, IEnumerable<string> values, int maxCount )
Public Shared Function FindElementsByExtendedProperty ( database As AFDatabase, propertyName As String, values As IEnumerable(Of String), maxCount As Integer ) As IList(Of KeyValuePair(Of String, AFElement)) Dim database As AFDatabase Dim propertyName As String Dim values As IEnumerable(Of String) Dim maxCount As Integer Dim returnValue As IList(Of KeyValuePair(Of String, AFElement)) returnValue = AFElement.FindElementsByExtendedProperty(database, propertyName, values, maxCount)
public: static IList<KeyValuePair<String^, AFElement^>>^ FindElementsByExtendedProperty( AFDatabase^ database, String^ propertyName, IEnumerable<String^>^ values, int maxCount )
static member FindElementsByExtendedProperty : database : AFDatabase * propertyName : string * values : IEnumerable<string> * maxCount : int -> IList<KeyValuePair<string, AFElement>>
Parameters
- database
- Type: OSIsoft.AFAFDatabase
The AFDatabase to search for the requested elements. - propertyName
- Type: SystemString
The name of the extended property to be searched. - values
- Type: System.Collections.GenericIEnumerableString
The list of extended property values to match for the specified propertyName. - maxCount
- Type: SystemInt32
The maximum number of elements to be returned from the search.
Return Value
Type: IListKeyValuePairString, AFElementReturns a list of KeyValuePairTKey, TValue items where the key is the value of the extended property and the value is the AFElement that matched the search for that key value. This allows the returned element to be matched with the specified extended property value without needing to load the full object from the server.
Remarks
This method will find the elements that have an extended property with the specified propertyName and its value set to one of the values in the list of specified values. All extended property values of type String and Guid on an AFElement are automatically indexed in the server to speed up the search on these types of property values. These are the only type of property values that can be searched. The QueryDate of the specified database will be used to determine the collection of elements that are returned from this method.
| Only elements that have been saved to the server will be returned by this search. This search is only supported on PI AF Server 2.6 or later. |
| Consider using the new AFElementSearch class for finding elements instead of using this method. |