How can I search by profile property? MSDN says it uses ProfileSearchManager, but it does not work. I want search users to be on the MobilePhone property.
SPServiceContext serviceContext = SPServiceContext.GetContext(site); UserProfileManager upm = new UserProfileManager(serviceContext); ProfileSearchManager sp = ProfileSearchManager.GetProfileSearchManager(serviceContext); string[] searchPattern = { "123" }; ProfileBase[] searchResults = sp.Search(searchPattern, ProfileSearchFlags.User); foreach (ProfileBase profile in searchResults) { Console.WriteLine(profile.DisplayName); }
source share