Unable to create user mysite

We have a .NET application code that creates CSC and MHSC using MS SharePoint 2013 object model. User Mysites are also created using this code.

The issue is while creating the user mysites through our code, sometimes the user mysites are created successfully and sometimes it fails with the below error message in our log.

ERROR - 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, Boolean loadColleagueRecordIds, String strEmail)
   at Microsoft.Office.Server.UserProfiles.UserProfile..ctor(UserProfileManager objManager, String strAcct, Boolean doNotResolveToMasterAccount, Boolean forceUserIsSelf, Boolean loadFullProfile, Boolean loadColleagueRecordIds, String strEmail)
   at Microsoft.Office.Server.UserProfiles.UserProfileManager.GetUserProfile(String strAccountName, Boolean doNotResolveToMasterAccount, Boolean loadFullProfile, Boolean loadColleagueRecordIds)
   at Microsoft.Office.Server.UserProfiles.UserProfileManager.GetUserProfile(String strAccountName, Boolean doNotResolveToMasterAccount)
   at Microsoft.Office.Server.UserProfiles.UserProfileManager.GetUserProfile(String strAccountName)

Below is the code snippet we are using to create user mysites

UserProfileManager profileManger = new UserProfileManager(SPServiceContext.GetContext(site));

UserProfile profile = profileManger.GetUserProfile(domainName + "\\" + sAMAccountName);

the error is appearing in the second line.

Please note that our code is running in multi tenancy system.

Regards

Goutam Mahato



May 19th, 2015 2:00am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics