SharePoint Hassles: The user does not exist or is not unique

n trying to add a user to a newly created site, I got this error. Turns out that I needed to add the user’s domain to the SPRoleAssignment:

SPRoleAssignment oRoleAssignment = new SPRoleAssignment(“DOMAIN\\User_Alias”,”User_Alias@Somewhere.com”,”Display_Name”,”Notes”);

This now seems to find the user, but is giving me a security error when I try to update the role assignments: “The security validation for this page is invalid.” but at least it is finding the user.

The solution to that error is to set spNewWeb.AllowUnsafeUpdates = true;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s