Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFContact.FindContacts Method (PISystem, String, AFSearchField, AFSortField, AFSortOrder, Int32, Boolean)

AFContact.FindContacts Method (PISystem, String, AFSearchField, AFSortField, AFSortOrder, Int32, Boolean)

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFContact.FindContacts Method (PISystem, String, AFSearchField, AFSortField, AFSortOrder, Int32, Boolean)
Performs a text search within the PISystem to retrieve a collection of AFContact objects that match the specified query string and to optionally not include contacts defined by Active Directory.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public static AFNamedCollectionList<AFContact> FindContacts(
	PISystem system,
	string query,
	AFSearchField field,
	AFSortField sortField,
	AFSortOrder sortOrder,
	int maxCount,
	bool includeActiveDirectory
)
Public Shared Function FindContacts ( 
	system As PISystem,
	query As String,
	field As AFSearchField,
	sortField As AFSortField,
	sortOrder As AFSortOrder,
	maxCount As Integer,
	includeActiveDirectory As Boolean
) As AFNamedCollectionList(Of AFContact)

Dim system As PISystem
Dim query As String
Dim field As AFSearchField
Dim sortField As AFSortField
Dim sortOrder As AFSortOrder
Dim maxCount As Integer
Dim includeActiveDirectory As Boolean
Dim returnValue As AFNamedCollectionList(Of AFContact)

returnValue = AFContact.FindContacts(system, 
	query, field, sortField, sortOrder, 
	maxCount, includeActiveDirectory)
public:
static AFNamedCollectionList<AFContact^>^ FindContacts(
	PISystem^ system, 
	String^ query, 
	AFSearchField field, 
	AFSortField sortField, 
	AFSortOrder sortOrder, 
	int maxCount, 
	bool includeActiveDirectory
)
static member FindContacts : 
        system : PISystem * 
        query : string * 
        field : AFSearchField * 
        sortField : AFSortField * 
        sortOrder : AFSortOrder * 
        maxCount : int * 
        includeActiveDirectory : bool -> AFNamedCollectionList<AFContact> 

Parameters

system
Type: OSIsoft.AFPISystem
The PISystem to search for the requested objects.
query
Type: SystemString

The query string used for finding contacts. When searching the Name field, the query string can be the full CanonicalName of the contact to find. When the full CanonicalName is specified, the AFActiveDirectoryProperties.UserFolder setting is ignored.

The query string can include regular characters and wildcard characters. Regular characters must be match exactly the characters specified in the query string. Wildcard characters can be matched with arbitrary fragments of the query string. The syntax of the query string has the following rules:

  • If or empty string, then everything will be matched.
  • If no wildcards, then an exact match on the query string is performed.
  • Wildcard * can be placed anywhere in the query string and matches zero or more characters. To match a literal *, then it can be escaped using the backslash (\) character (i.e. '\*').

field
Type: OSIsoft.AFAFSearchField
Specifies which of the object's properties are searched.
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.
includeActiveDirectory
Type: SystemBoolean
Specifies whether to search Active Directory for contacts. If , the contacts defined by Active Directory will not be returned.

Return Value

Type: AFNamedCollectionListAFContact
Returns the collection of AFContact objects which match the specified query string.

Remarks

This method will return contacts specifically added to the server and optionally contacts defined by Active Directory based on the includeActiveDirectory parameter. An object matches the text search if the specified query is found in one of the object's properties specified by the field parameter.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5

See Also

In This Topic
TitleResults for “How to create a CRG?”Also Available in