Hello
I am writing a user registration system in which users may register as self-service. I can send the users to AD without any problems but when I try to create a user profile for them I just get an error message which seems to be "wrong".
The AD registration, add to profile and add to relevant groups is (or rather will be) handled by a console application. When I run the console application the user gets added to AD without any problems but when I try to add them to Sharepoint profiles I (most often - not always) get the followinf diagnstics, error message and stack trace like here.
EXTRANET\testUser added to AD
create user profile
Microsoft.Office.Server.UserProfiles.UserNotFoundException: A user with the spec
ified SID could not be found in the domain. Check the spelling of the account n
ame 'EXTRANET\testUser' and try again.
at Microsoft.Office.Server.UserProfiles.UserProfileGlobal.GetSidFromAccount(S
tring strAccountName, SID_NAME_USE[] IntendedAccountType, SID_NAME_USE& sidUse)
at Microsoft.Office.Server.UserProfiles.UserProfileGlobal.GetSidFromAccount(S
tring strAccountName)
at Microsoft.Office.Server.UserProfiles.UserProfileGlobal.GetSidFromAccount(U
serProfileApplicationProxy proxy, Guid partitionID, String strAccountName, Boole
an isWindowsAccount)
at Microsoft.Office.Server.UserProfiles.UserProfile.set_SID()
at Microsoft.Office.Server.UserProfiles.UserProfile..ctor(UserProfileManager
objManager, String strAccountName, String strPreferredName)
at Microsoft.Office.Server.UserProfiles.UserProfileManager.CreateUserProfile(
String strAccountName, String strPreferredName)
at Microsoft.Office.Server.UserProfiles.UserProfileManager.CreateUserProfile(
String strAccountName)
at UserImport.Program.<>c__DisplayClassf.<Main>b__1() in c:\My_Projects\UserImport\UserImport\Program.cs:line 335
The relevant code is as follows ( I added a wait for 5 seconds just to be sure AD had time to update):
Thread.Sleep (5000);
debug += "create user profile\n"; UserProfileManager userProfileMgr = new UserProfileManager(serviceContext); UserProfile userProfile = userProfileMgr.CreateUserProfile("EXTRANET\\" + account);
Any help would be appreciated more than I can express!
Wbr
hank