We're having the issue where user's names shown after logging in are being preffixed with the membership provider information, e.g. i:0#.f|fbamembershipprovider|myemail@q...
(note that we're using FBA rather than AD)
I've found many articles that explain how to change this in powershell, but on an individual user by user basis, so I decided to write a small C# console app to make the changes on all affected users:
static void Main(string[] args)
{
string serverName = ConfigurationManager.AppSettings["qmServer"];
bool performUpdates = Convert.ToBoolean(ConfigurationManager.AppSettings["qmPerformUpdates"]);
int updatesPerformed = 0;
int updatesRequired = 0;
StringBuilder updatedUsers = new StringBuilder();
using (SPSite site = new SPSite(serverName))
{
using (SPWeb web = site.OpenWeb("/"))
{
bool allowUpdates = web.AllowUnsafeUpdates;
web.AllowUnsafeUpdates = true;
SPUserCollection userColl = web.AllUsers;
foreach (SPUser user in userColl)
{
if (user.Name.IndexOf("i:0#.f|fbamembershipprovider|") == 0)
{
updatesRequired++;
if (performUpdates)
{
try
{
user.Name = user.Name.Replace("i:0#.f|fbamembershipprovider|", "");
user.Update();
updatesPerformed++;
}
catch { }
}
updatedUsers.AppendLine(user.Name);
}
}
web.Update();
web.AllowUnsafeUpdates = allowUpdates;
}
}
}
The problem is that while this works, the effect is only temporary. Sometime later (within 1 hour I think), the affected names are reverted back to showing the membership info.
Can anyone advise why the updates are not permanent? Is there a server (User Profile Sync?) that might be reverting the names?
Any guidance would be appreciated.
Kevin
Farm User Profile Service Proxy - User Profile to SharePoint Full Synchronization
. Having disabled this (temporarily until I find out exactly what it does), I've not seen my 'fixed' display names reverting back to their former values, and it's been over an hour. So, fingers crossed! @sween_sp if you want to add an 'answer', I can mark it as such.