Changing users Email in the database

Sep 23, 2015 at 12:45 PM
Edited Sep 23, 2015 at 12:46 PM
In my current setup I create new users from Microsoft Crm, when a certain entity (contact) is created I add users to the database directly (in the membership and users tables). I also have code to take care of authorization and roles.

At the moment I am trying to write code that makes it possible to change a users Email address. Again I update both tables in SQL. This makes it possible to login with a different Email while still being the "same" user.

This does not work for permissions though. It seems like the user loses all permissions from lists with unique permissions. I can however go to the list in sharepoint and add the new email address manually. If I do this I also need to delete the old mail reference.

How can I change a users Email address and at the same time retain it's permissions? Is this possible? Or do I need to find a way to "copy" over all the existing permissions from one mail address to the next.

Any help is much appreciated, thanks in advance!
Sep 23, 2015 at 9:13 PM
When you say you change both fields in the membership db, I assume you mean that you are using the email address as the username. SharePoint expects the username to remain static, to link it with the matching SharePoint user profile. If you're changing the username, you'll have to migrate the user using Move-SPUser:

There's some examples of moving fba users with move-spuser here:
Sep 24, 2015 at 11:47 AM
That's exactly what I needed, got everything up and running now with no issues.

Thank you so much for your quick response.