UserProfiles - UserNotFoundExceptio
-
06-12-2019 - |
Domanda
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, Nullable
1 recordId, Guid gAcct, String strAcct, Byte[] bSid, String strEmail, Boolean doNotResolveToMasterAccount) at Microsoft.Office.Server.UserProfiles.UserProfile.RetrieveUser(String strAcct, Guid gAcct, Byte[] bSid, Nullable
1 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.
Soluzione 2
The problem was solved by performing an IISRESET after the full userprofile import.
Altri suggerimenti
Are you trying to get a UserProfile object for the current user? You can simply get it via ProfileManager:
UserProfile profile = profileManger.GetUserProfile(true);