Share via


ProfileManagerBase.Search method

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

Overload list

  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.
Public method Search([]) Retrieves an array of ProfileBase objects of a particular profile type whose searchable properties match the specified search patterns.
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.
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.
Public method Search([], Int32, Nullable<Boolean>) Return profiles for specific subtypes, 0 means all subtypes.

Top

Remarks

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);
}

See also

Reference

ProfileManagerBase class

ProfileManagerBase members

Microsoft.Office.Server.UserProfiles namespace