Showing posts with label User Profile Service Error in SharePoint. Show all posts
Showing posts with label User Profile Service Error in SharePoint. Show all posts

Monday, November 25, 2013

SharePoint user profile service error: An error was encountered while retrieving the service

While working with SharePoint user profile through code, I got an error when accessing the user profile from user profile manager. Stack trace has thrown the error as,  

Microsoft.Office.Server.UserProfiles.UserNotFoundException was unhandled
  Message=An error was encountered while retrieving the user profile.
  Source=Microsoft.Office.Server.UserProfiles

I have checked in User profile service that account crawled correctly or not. Yes it is there. Iam able to get the user in SharePoint user picker as expected. I have googled about the issue for some time. I have fixed the exception using an article from technet. Tip shown in the blog post fixed my error.

Actually iam getting the error from following code line 

UserProfile currentUser = profileManager.GetUserProfile("Domain\UserName")


Here profilemanager is UserProfileManager object. After changing “\” to “\\” in user profile my issue got fixed. I have replaced my code line with 

UserProfile currentUser = profileManager.GetUserProfile("Domain\\UserName")

Simple. Hope this will help you.

Monday, September 23, 2013

SharePoint User Profile Service Error – Cannot navigate to the requested page because the service is not running”

While working with user profile service in SharePoint, configuring new connection, I got an error saying that “Cannot navigate to the requested page because…” as shown in the image below.


To fix this we need to start the user profile service in the services. But we need to have “Replicating domain changes” permissions. Without this we can’t import the changes from AD to SharePoint/SharePoint to AD.

To provide the permission, Right click on Active Directory and select “Delegate Control” option.


We can see the wizard, select the user and click next, in the Permissions window; we need to grant “replicate Directory Changes” right for the user.



Now we need to start the User Profile Synchronization service in Services. It will take some little time to start.