Question

I would like to get all User Profiles where a specific user is manager (programmatically). Does anybody have an idea what's the best solution for that? It should work like in "My organization browser" and "My organization chart". E.g. I have an instance of user profile "Keaton, Dean" and I want to know from which users he is a manager.

enter image description here

If I search the UserProfileManager-Class and UserProfile-Class one way is to iterate threw all user profiles in user profile manager but I've read that this is not the best solution for performance reasons.

foreach(UserProfile up in upm)
{
  if(up["Manager"]==manager)
      ...
}

If I use FullTextSQLQuery I can't get any results although I added the "Manager"-Property to the Metadata Properties and finished a full crawl.

Any help is appreciated! Thanks.

Was it helpful?

Solution

It looks like you are using 2010, but this should work in both 2010 and 2013.

I'd try creating a managed property and assign the crawled property People:Manager. In the UPA you will probably have to mark Manager as indexable. Make the managed property queryable, searchable and retrievable if in 2013. Recrawl the user profiles and then perform the search Manager:{Name}.

M

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top