AFElement.FindElementsByCategory Method (AFDatabase, AFElement, AFCategory, Boolean, AFSortField, AFSortOrder, Int32)
- Last UpdatedNov 18, 2025
- 4 minute read
- PI System
- AF SDK 2024 R2
- Developer
Note: This API is now obsolete.
Retrieves a non-paged collection of AFElement objects that have the specified AFCategory
defined for the element.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[BrowsableAttribute(false)] [ObsoleteAttribute("This method has been replaced by the 'AFElementSearch' class using the 'Root' and 'Category' filters.")] public static AFNamedCollectionList<AFElement> FindElementsByCategory( AFDatabase database, AFElement searchRoot, AFCategory refCategory, bool searchFullHierarchy, AFSortField sortField, AFSortOrder sortOrder, int maxCount )
<BrowsableAttribute(false)> <ObsoleteAttribute("This method has been replaced by the 'AFElementSearch' class using the 'Root' and 'Category' filters.")> Public Shared Function FindElementsByCategory ( database As AFDatabase, searchRoot As AFElement, refCategory As AFCategory, searchFullHierarchy As Boolean, sortField As AFSortField, sortOrder As AFSortOrder, maxCount As Integer ) As AFNamedCollectionList(Of AFElement) Dim database As AFDatabase Dim searchRoot As AFElement Dim refCategory As AFCategory Dim searchFullHierarchy As Boolean Dim sortField As AFSortField Dim sortOrder As AFSortOrder Dim maxCount As Integer Dim returnValue As AFNamedCollectionList(Of AFElement) returnValue = AFElement.FindElementsByCategory(database, searchRoot, refCategory, searchFullHierarchy, sortField, sortOrder, maxCount)
public: [BrowsableAttribute(false)] [ObsoleteAttribute(L"This method has been replaced by the 'AFElementSearch' class using the 'Root' and 'Category' filters.")] static AFNamedCollectionList<AFElement^>^ FindElementsByCategory( AFDatabase^ database, AFElement^ searchRoot, AFCategory^ refCategory, bool searchFullHierarchy, AFSortField sortField, AFSortOrder sortOrder, int maxCount )
[<BrowsableAttribute(false)>] [<ObsoleteAttribute("This method has been replaced by the 'AFElementSearch' class using the 'Root' and 'Category' filters.")>] static member FindElementsByCategory : database : AFDatabase * searchRoot : AFElement * refCategory : AFCategory * searchFullHierarchy : bool * sortField : AFSortField * sortOrder : AFSortOrder * maxCount : int -> AFNamedCollectionList<AFElement>
Parameters
- database
- Type: OSIsoft.AFAFDatabase
The AFDatabase to search for the requested objects. - searchRoot
- Type: OSIsoft.AF.AssetAFElement
The root object to start the search. If , then the search starts at the AFDatabase. - refCategory
- Type: OSIsoft.AFAFCategory
The reference AFCategory used when determining if a returned AFElement is referenced from this element. If , then all elements without any category will be returned. - searchFullHierarchy
- Type: SystemBoolean
Specifies if the search should include objects nested further than the immediate children of the searchRoot. - sortField
- Type: OSIsoft.AFAFSortField
The field or property of the object used to sort the returned collection. - sortOrder
- Type: OSIsoft.AFAFSortOrder
The order that the returned collection is sorted. - maxCount
- Type: SystemInt32
The maximum number of objects to be returned.
Return Value
Type: AFNamedCollectionListAFElementReturns a collection containing the first page of AFElement objects that have the specified AFCategory defined for the element under the searchRoot element or the database.
Remarks
This method will return the elements that have the specified refCategory defined under the specified searchRoot element or the database. If the searchRoot is specified, then its QueryDate will be used to determine the collection of elements that are returned. Otherwise, the QueryDate of the database will be used.
| If a searchRoot is specified and the searchFullHierarchy parameter is , then any added or removed element references that have not been checked in will be ignored when searching the hierarchy. |
| Consider using the new AFElementSearch class for finding elements instead of using this method. |
Version Information
AFSDK
Supported in: 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4Obsolete (compiler warning) in 3.1.1
Obsolete (compiler warning) in 3.1.0
Obsolete (compiler warning) in 3.0.2
Obsolete (compiler warning) in 3.0.1
Obsolete (compiler warning) in 3.0.0
Obsolete (compiler warning) in 2.10.11
Obsolete (compiler warning) in 2.10.5
Obsolete (compiler warning) in 2.10.0
Obsolete (compiler warning) in 2.10
Obsolete (compiler warning) in 2.9.5
Obsolete (compiler warning) in 2.9