다음을 통해 공유


ProfileManagerBase.Search Method

Include Protected Members
Include Inherited Members

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) 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, []) 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>)

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