I'm trying to follow along with the SDK example "How to retrieve a User Profile". I am calling the UserProfileManager constructor with a SPServiceContext object.
When I run this code as the farm account i.e. the service account the User Profile Service Application is running as, everything is fine. However when I run this code as a normal user who is a Farm Admin, a User Profile Service App Admin and who has been granted Shell Access to all databases, I get an exception:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.get_ApplicationProperties()
at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.CheckAdministrationAccess(UserProfileApplicationAdminRights rights, Boolean requireAllRights)
at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.CheckAdministrationAccess(UserProfileApplicationAdminRights rights)
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase.CanManagePeople(UserProfileApplicationProxy userProfileApplicationProxy)
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase.get_IsProfileAdmin()
at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(SPServiceContext serviceContext, Boolean IgnoreUserPrivacy, Boolean backwardCompatible)
at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(SPServiceContext serviceContext)
at UserProfilesGetProperty.Program.Main(String[] args)
From the ULS logs, I can tell that it is failing with an Access is Denied error message for some WCF related User Profile calls. But I can't see how that could be when I am a farm, service app and shell admin for all databases.
Any thoughts would be appreciated. Thanks...