Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Scenario:

  • User X (AD user) has access to the sharepoint environment (full control permissions)
  • Environment is load balanced
  • The customer told me they use different domain notations (old = KL_CUSTOMERNAME, new CUSTOMERNAME.BE)
  • Userprofile import has been done. User X is available.
  • User X is available in the user information list

In a webcontrol on the homepage of our portal - I'm running the following code:

UserProfileManager profileManager = new UserProfileManager(SPServiceContext.GetContext(SPContext.Current.Site));
UserProfile profile = profileManager.GetUserProfile(HttpContext.Current.User.Identity.Name);

I'm getting the following error when the user hit the page (webcontrol):

(Er is een fout opgetreden bij het ophalen van het gebruikersprofiel.) Microsoft.Office.Server.UserProfiles.UserNotFoundException at Microsoft.Office.Server.UserProfiles.UserProfileCache.GetUserData(UserProfileManager objManager, Nullable1 recordId, Guid gAcct, String strAcct, Byte[] bSid, String strEmail, Boolean doNotResolveToMasterAccount) at Microsoft.Office.Server.UserProfiles.UserProfile.RetrieveUser(String strAcct, Guid gAcct, Byte[] bSid, Nullable1 recordId, Boolean doNotResolveToMasterAccount, Boolean loadFullProfile) at Microsoft.Office.Server.UserProfiles.UserProfile..ctor(UserProfileManager objManager, String strAcct, Boolean doNotResolveToMasterAccount, Boolean forceUserIsSelf, Boolean loadFullProfile) at Microsoft.Office.Server.UserProfiles.UserProfileManage...
65228af1-c6c3-4d84-a93f-752ff4c2f222 11/07/2011 16:47:23.07* w3wp.exe (0x3394) 0x2A90 AZGroeninge Intranet
WebControls 0000 Unexpected
...r.GetUserProfile(String strAccountName, Boolean doNotResolveToMasterAccount, Boolean loadFullProfile) at Microsoft.Office.Server.UserProfiles.UserProfileManager.GetUserProfile(String strAccountName, Boolean doNotResolveToMasterAccount) at Microsoft.Office.Server.Us

Note: There are a couple of users for which the exception does not occur. Those users also have full control.

Has it something to do with the domain notations?

Thanks in advance.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

The problem was solved by performing an IISRESET after the full userprofile import.

share|improve this answer

Are you trying to get a UserProfile object for the current user? You can simply get it via ProfileManager:

UserProfile profile = profileManger.GetUserProfile(true);
share|improve this answer
    
Yes,that's correct - but I use another constructor... I does the same thing (normally) –  Sven Gillis Nov 9 '11 at 11:44
    
@SvenGillis: It does the same thing if User.Identity.Name is exactly the same as the account name format expected by the UserProfile constructor. If you are looking for the current user, there is no reason not to use the default one. –  Nemanja Trifunovic Nov 9 '11 at 13:41
    
Thanks for the tip Nemanjan. I investigated this a little further. When I use HttpContext.Current.User.Identity.Name for user X I notice it has the same domain notation as user Y. Nevertheless, I can retrieve the UserProfile object of user Y and not for user X. What am I missing here? –  Sven Gillis Nov 9 '11 at 18:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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