1

I have a problem getting user profile saved. It works fine if I'm changing profile fields of string type e.g. WorkEmail or FirstName, but when it comes to the type of person, e.g. Manager, it gives me an error.

The exception message is:

"Invalid Property Value: Could not find SID corresponding to input account name"

However, If I try to retrieve the user (which are imported from the AD) I can see that it has a SID mapped into that specific account name.

UserProfileManager profileManager = new UserProfileManager(context);
UserProfile u = profileManager.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);

u[PropertyConstants.Manager].Value = "domain\\abcde"

1 Answer 1

1

You need to set the SPUser value for the manager field and not string.

To do that, you can use the web.EnsureUser() method.

Try it as below:

UserProfileManager profileManager = new UserProfileManager(context);
UserProfile u = profileManager.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);

u[PropertyConstants.Manager].Value = web.EnsureUser("domain\\abcde");
u.Commit();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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