I'm creating web part that will show user's links and sites. When I'm trying to get context from SPServiceContext information server throws me exception:
No User Profile Application available to service the request. Contact your farm administrator...
This is my code:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager mgr = new UserProfileManager(context);
UserProfile userProfile = mgr.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName);
}
}
I have checked that "User Profile Service Application" is started. What I'm missing? How to collect user profile details?
Regards
