I found some examples on the internet (this one I understand the most). I am confused on how to implement it. I do not know which assemblies I need to reference. Also, shouldn't I use classes from SharePoint's API? I am using SharePoint 2010. Thanks.

2 Answers 2


The example you provided by the link does use the Sharepoint API (using Microsoft.Office.Server; using Microsoft.SharePoint;using Microsoft.Office.Server.UserProfiles;). In order to be able to use those namespaces, you need to reference Microsoft.Sharepoint.dll, Microsoft.Office.Server.dll and Microsoft.Office.Server.UserProfiles.dll. I suggest you start with a console application (don't forget to set its platform target to Any CPU), add the above references and take portions of the code from your link and try out how it works. It's the fastest way to get familiar with something new.

If you can't find the dll's above on your server, it means you have Sharepoint Foundation. You need Sharepoint Server 2010 to use the UserProfiles.

I hope it helped.


The example you posted uses the SharePoint Object Model, and that's a perfectly acceptable way to get the information you're looking for. Using the Client Side Object Model with UPS data 'can' be temperamental. While you can pull UPS information from the user information list, the accuracy of the information is based on a timer job that copies a users UPS profile data into the site collection's user information list on an interval, so the JS CSOM doesn't query UPS directly (I have a blog post that discusses some of it here). In my opinion, any interaction with UPS is best done in code vs. JavaScript for the simple fact that in code you can talk directly to the SSA, which you cannot do with the JS CSOM. There is also some web service capabilities, but all of the SOAP stuff is being deprecated, so I'm not sure I'd put a ton of effort into those right now. In a pinch you certainly could use SPServices and jQuery to send off a SOAP request to the UPS Web Service.

UPS by default will pull the user's manager into the profile as long as there's good manager data in Active Directory; so it's likely that UPS is already setup with that unless someone in your organization changed the UPS configuration. Unfortunately, in a lot of environments that data is either not present, or wrong, so you may want to confirm (before you start relying on it) that there is good, solid manager data in Active Directory before you go down this path. I can't tell you how many people I've talked to that can't figure out why their code doesn't work, only to then discover that AD has no manager data.

For what it's worth, if you were using the manager lookup capabilities of a SPD workflow, that works in the same way (at a high level) as the example you've posted. The workflow will grab the current user's profile data, lookup the manager, then resolve the manager's profile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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