Here's another in what seems like a growing list of permissions gotchas in SharePoint 2010. Assume if you will, you are a crack developer and building a custom application for SharePoint 2010. You're writing code on your development server, which has a FULLY functioning installation of SharePoint 2010. You want to work with some user profile data, so you create an instance of the UserProfileConfigManager. Strangely, when you do this you get an exception that says "No User Profile Application available to service the request. Contact your farm administrator."
Hmm, seems strange. You double check your settings, your user profile service application is up and running. You're probably a farm admin even in this scenario and you are able to manage it - so what is the scoop? You may think, ah, I need to grant myself rights to manage the application. We've seen that behavior in another posting I published just today on working with FAST user contexts. So you find your user profile service app, click on the Administrators button in the ribbon and give your self Full Control rights to it. You try again - same problem. Grrr! Yes, this can get frustrating. As it turns out, there is yet another place where you may need to set permissions, and this is one of those cases. If you look in the ribbon when you select a service application, you will see the Administrators button, but there is also the Permissions button on the far right. In this case, click the Permissions button. Add your account and give it Full Control rights. NOW, go back and try your code again - this time it should work.
Sorry, I wanted to add one other scenario I have seen happen. Many times you create the ServiceContext for getting the UserProfileManager by getting a reference to an SPSite and then using the SPServiceContext.GetContext method. What I have seen happen before is that if that site that you create the SPSite reference to allows anonymous access, you may still get this error. When disabling anonymous access at the site collection level it started working. Just another FYI.
After some "Grrr!" I finally found your blog post. Thank you!
i am still in Grrrrrrrr! mode.. tried giving full access to me.. still same grrrrr. help me
Have you double checked it?
For me it also didn't work but after a restart I found the user lost so I retried and it worked at once!
Will try this out and report back the results.
Thanks so much !! After an IISRESET it worked perfectly !!
Worked for me, remember to close and reopen your pshell window ;)
what do I do if I get this error when I try to open user profile service application ??? I'm going nutz...
Thanks for the tip. No more Grrrrrrr moments here :)
Thank you for this post! It saved me a lot of time and grrrrs :)
I tried this still problem with the profile service
Thanks.. This helped me out with a program that I was trying to use to do a bulk import of user profile pictures. I did have to reboot the server. though an IISRESET may have worked!
Thanks, saved me a lot of time to find this blog post! :-)
You my god! It is really best post in my life!! )) Solve problem for Profile it is really that I need! It is like shoot in apple!
Thanks very much for your sharing!
It really helps me a lot!
It's a good approach but my Grrrrrrr's not stop. I receive this error when I add a Outlook WebPart :(