Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

UserProfileManager.Search method

Retrieves an array of ProfileBase objects of this profile type whose searchable properties match a specified search pattern.

  Name Description
Public method Search(String) Retrieves an array of ProfileBase objects of a particular profile type whose searchable properties match the specified search pattern. (Inherited from ProfileManagerBase.)
Public method Search([]) Retrieves an array of ProfileBase objects of a particular profile type whose searchable properties match the specified search patterns. (Inherited from ProfileManagerBase.)
Public method Search(OrganizationProfile, String) Obsolete. Retrieves an array of users and organizations (as ProfileBase objects) under the specified OrganizationProfile object whose searchable properties match a specified search pattern. (Inherited from ProfileManagerBase.)
Public method Search(OrganizationProfile, []) Obsolete. Retrieves an array of users and organizations (as ProfileBase objects) under the specified OrganizationProfile object whose searchable properties match the specified search patterns. (Inherited from ProfileManagerBase.)
Public method Search([], Int32, Nullable<Boolean>) Return profiles for specific subtypes, 0 means all subtypes. (Inherited from ProfileManagerBase.)
Top

The searchable profile properties are FirstName, LastName, PreferredName, UserName, Office, Title, Department, WorkEmail, SPS-SipAddress, and AccountName. To retrieve objects of multiple ProfileType, use ProfileSearchManager.

The following sample shows how to use this class.

SPSite siteColl = SPContext.Current.Site;
SPServiceContext serviceContext = SPServiceContext.GetContext(siteColl);
UserProfileManager upm = new UserProfileManager(serviceContext);
 
//Use either the string or the array of strings
//string[] searchPattern = { “User”, “UserOne”};
string searchPattern = “User”;
ProfileBase[] searchResults = upm.Search(searchPattern);

foreach (ProfileBase profile in searchResults)
{
Console.WriteLine(profile.DisplayName);
}

Show:
© 2015 Microsoft