0

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.

1

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

  • Hi Matthew, thank you for your answer! You are right. I use SP2010 and not 2013... I checked the property as "Indexable" in the UPA and recrawled the User Profiles but with no luck. I'll try it later again :) – lex Aug 26 '13 at 12:45
  • 1
    Did you create a managed property for manager? It is not set up that way out of the box. – Matthew McDermott Aug 26 '13 at 20:44
  • Yep. I did...and after that a full crawl. Today I had no time to search for a solution... Tomorrow I'll try it again. Thanks – lex Aug 27 '13 at 15:02
  • OK, let me know. It worked for me on my test environment in 2013, no reason it should be any different in 2010, but I can test it if it fails for you. – Matthew McDermott Aug 27 '13 at 21:35
  • Hi Matthew. This is really kind of you! I'll try it the next days and give you a message if (or if not) it works. Wish you a nice day. – lex Aug 29 '13 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.