SharePoint 2010: User Display Name shows “i:0#.f|” using Form Based Authentication

I had to implement Form Based Authentication for my company, but ( there is always a but ^^ ) display names where not showing up correctly for accounts in the Forms Auth using the FBA membership provider.

User Display Name show i:0#.f| using form based authentication

Believe me whatever you do its not picking it up from Active Directory User Display Name instead the user display name is like. I received each time i:0#.F\g.ozcifci

I did get this issue because we ran the command $wa.MigrateUsers($true): BAD CHOISE !! I it will migrate each user from AD to FBA (more info Change SharePoint authentication from classic mode to claims based )

 

$wa = get-SPWebApplication $WebAppName

$account = (New-SPClaimsPrincipal -identity $account -identitytype 1).ToEncodedString()

$zp = $wa.ZonePolicies("Default")

$p = $zp.Add($account,"PSPolicy")

$fc=$wa.PolicyRoles.GetSpecialRole("FullControl")

$p.PolicyRoleBindings.Add($fc)

$wa.Update()

  • perform user migration

$wa = get-SPWebApplication $WebAppName

$wa.MigrateUsers($true)

 

Solution:

  1. You would need to run a PowerShell command for the –Web parameter being the SiteCollection URL.
  2. You would need to login to that Site Collection at least once for the script to update the Display Name. This is something like alerts on a site will work for the user if we would have logged into that site collection at least once.
Set-SPUser “i:0#.f|g.ozcifci” -Web http://sp2010/ -DisplayName "OZCIFCI, Gokan "

 

Great Script for Migrating Users from SharePoint 2007 FBA to SharePoint 2010 FBA : Link