2007-07-02

My memberships are pointing to the old domain address after making a domain change

We had to change the domain address for our SharePoint 2007 installation. This went well, but My memberships (for every user) still point to sites with the old domain address. Why? I don't know, and I don't know why it didn't get automatically updated. Haven't found any information on the profile memership sync job either...

If I don't find a no-code solution, I guess I must go through all the memberships of every user and change the Url's by code. Not a big deal, but... it gave me some hard time until the followin simple code fixed problem:

Membership[] memberships = userProfile.Memberships.GetItems();
foreach (Membership membership in memberships)
{
// Fix the Url
string newUrl = membership.Url.Replace(textOld.Text, textNew.Text);

// Update the membership Url
membership.MembershipGroup.Url = newUrl;

// Commit the change
membership.MembershipGroup.Commit();
}

3 comments:

Brenton Crosby said...

I've also got the same problem and haven't been able to find any information on where/how to change this. Any chance you can let me know where/how to run this code?

Frode Sørhøy, Avenir, Bergen, Norway said...

Brenton,

If I remeember correct I ranthe code snippet in a Windows Application. The application iterated through all the user profiles and fixed membership links. I ran the application on the production server.

Frode

Brenton Crosby said...

Hi Frode,
Any chance you can let me know how to run the code? I'm not a developer so you'll have to assume I know nothing about coding. I know a little vb/bash scripting but not how to run code against MOSS.