none
In people picker Fullname is not shown in displayName column with LdapMembership provider

    Question

  • I have configured forms authentication with ldapmembership in my sharepoint site.

    Following is the part of my central admin web.config

    Everything works fine except user FullName is not displayed. In place of displayName it shows sAMAccountName.

    Example:

    sAMAccountName (in Active Directory) = shams
    displayName (in Active Directory) = Shamsul Arefin

    So when the user shams login to sharepoint it shows 'shams' instead of 'Shamsul Arefin' in Welcome control.


    <

     
    membership defaultProvider="LdapMembershipProvider">
    <providers>
    <add name="LdapMembershipProvider" type="Microsoft.Office.Server.Security.LDAPMembershipProvider, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
    server="servername" port="389" useSSL="false"
    userDNAttribute="distinguishedName" userNameAttribute="sAMAccountName"
    userContainer="xx"
    userObjectClass="person" userFilter="(|(ObjectCategory=group)(ObjectClass=person))"
    scope="Subtree" otherRequiredUserAttributes="sn,givenname,cn,displayName"/> providers> membership>
    <roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".PeopleDCRole">
    <providers>
    <add name="LdapRole" type="Microsoft.Office.Server.Security.LDAPRoleProvider, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
    server="servername" port="389" useSSL="false" groupContainer=xx" groupNameAttribute="cn"
    groupMemberAttribute="member" userNameAttribute="sAMAccountName" dnAttribute="distinguishedName" groupFilter="(ObjectClass=group)" scope="Subtree" /> providers>
    </roleManager>

    And Following is the part of my site web.config

    <membership defaultProvider="LdapMembershipProvider">
    <providers>
    <add name="LdapMembershipProvider" type="Microsoft.Office.Server.Security.LDAPMembershipProvider, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"  server="servername" port="389" useSSL="false" userDNAttribute="distinguishedName" userNameAttribute="sAMAccountName" userContainer="xx" userObjectClass="person" userFilter="(|(ObjectCategory=group)(ObjectClass=person))" scope="Subtree" otherRequiredUserAttributes="sn,givenname,cn,displayName" /> providers>
    </membership>
    <roleManager defaultProvider="LdapRole" enabled="true" cacheRolesInCookie="true" cookieName=".PeopleDCRole">
    <providers>
    <add name="LdapRole" type="Microsoft.Office.Server.Security.LDAPRoleProvider, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"  server="servername" port="389" useSSL="false" groupContainer="xx" groupNameAttribute="cn" groupMemberAttribute="member" userNameAttribute="sAMAccountName" dnAttribute="distinguishedName" groupFilter="(ObjectClass=group)" scope="Subtree" /> providers> roleManager>

    Friday, January 8, 2010 8:43 AM

Answers

  • Hi,

    AFAIK, that is the standard behaviour, as there is no attribute in the LdapMembershipProvider to specify the user display name.

    If you have MOSS 2007 (not WSS 3.0 only) check the user profile of the users (shams, for example), and set the full name if you wish.

    Alternatively you can import full name as part of the user profile properties from LDAP, as described here:
    Active Directory for FBA in SharePoint using LDAP
    http://www.codedigest.com/Articles/Sharepoint/94_Active_Directory_for_FBA_in_SharePoint_using_LDAP.aspx

    In WSS 3.0 you can set the DisplayName property of the user through the hidden user list.
    SharePoint's hidden user-list - User Information List 
    http://www.zimmergren.net/archive/2008/06/25/sharepoints-hidden-user-list-user-information-list.aspx

    Hope that helps.

    Peter
    • Marked as answer by Chengyi Wu Friday, January 15, 2010 8:04 AM
    Friday, January 8, 2010 2:13 PM
  • Hi,

         Thanks for Peter’s suggestion and links, but based on your last post, it seems another requirement.

         You need to monitor the user information list and get notification when adding user to this list.

         Referring to  this article(http://msdn.microsoft.com/en-us/library/aa979520.aspx),  “Lists:List events do not fire on the UserInfo list.”

         Unfortunately, we can’t attach any events on this list. Instead, you can create a Service Application hosted on the server to monitor this list to walk around.

         You can use SPSite level audit. After you enable the Editing users and permissions audit, it can record all the user/group action log, like the simple sample below:

         -------------------------------------------------------------------------------------------------------------

          using (SPSite site = new SPSite("url"))

                {

                    SPAuditQuery wssQuery;

                    SPAuditEntryCollection auditCol;

                    wssQuery = new SPAuditQuery(site);

                    wssQuery.AddEventRestriction(SPAuditEventType.SecGroupCreate);

     

                    //Also some Enum type for group:

                    //SecGroupCreate/SecGroupDelete/SecGroupMemberAdd/SecGroupMemberDel

                    auditCol = site.Audit.GetEntries(wssQuery);

                    foreach (SPAuditEntry entry in auditCol)

                    {

                         //Execute send mail action here

                    }

                }

          -------------------------------------------------------------------------------------------------------------

         Using SharePoint Time-Job to integrate the logic  is an option, if you consider to do so, please refer:

         Timer Job(http://msdn.microsoft.com/en-us/library/bb862072.aspx)
        
    Creating Custom Timer Jobs in Windows SharePoint Services 3.0(http://msdn.microsoft.com/en-us/library/cc406686.aspx)
        
    Creating Custom SharePoint Timer Jobs (http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx)

     

         Hope this can help.

     

     Best Regards,

     -Aaron

    • Marked as answer by Chengyi Wu Friday, January 15, 2010 8:04 AM
    Monday, January 11, 2010 5:06 AM

All replies

  • Hi,

    AFAIK, that is the standard behaviour, as there is no attribute in the LdapMembershipProvider to specify the user display name.

    If you have MOSS 2007 (not WSS 3.0 only) check the user profile of the users (shams, for example), and set the full name if you wish.

    Alternatively you can import full name as part of the user profile properties from LDAP, as described here:
    Active Directory for FBA in SharePoint using LDAP
    http://www.codedigest.com/Articles/Sharepoint/94_Active_Directory_for_FBA_in_SharePoint_using_LDAP.aspx

    In WSS 3.0 you can set the DisplayName property of the user through the hidden user list.
    SharePoint's hidden user-list - User Information List 
    http://www.zimmergren.net/archive/2008/06/25/sharepoints-hidden-user-list-user-information-list.aspx

    Hope that helps.

    Peter
    • Marked as answer by Chengyi Wu Friday, January 15, 2010 8:04 AM
    Friday, January 8, 2010 2:13 PM
  • Thanks for the reply.

    Can I add item even handler to the hidden user information list, so that when a new user is added i can update the display name?

    If not, can i use any other kind of event by which I can be notified that a new user has been added to the site.

    Thanks in advance.
    Sunday, January 10, 2010 7:42 AM
  • Hi,

         Thanks for Peter’s suggestion and links, but based on your last post, it seems another requirement.

         You need to monitor the user information list and get notification when adding user to this list.

         Referring to  this article(http://msdn.microsoft.com/en-us/library/aa979520.aspx),  “Lists:List events do not fire on the UserInfo list.”

         Unfortunately, we can’t attach any events on this list. Instead, you can create a Service Application hosted on the server to monitor this list to walk around.

         You can use SPSite level audit. After you enable the Editing users and permissions audit, it can record all the user/group action log, like the simple sample below:

         -------------------------------------------------------------------------------------------------------------

          using (SPSite site = new SPSite("url"))

                {

                    SPAuditQuery wssQuery;

                    SPAuditEntryCollection auditCol;

                    wssQuery = new SPAuditQuery(site);

                    wssQuery.AddEventRestriction(SPAuditEventType.SecGroupCreate);

     

                    //Also some Enum type for group:

                    //SecGroupCreate/SecGroupDelete/SecGroupMemberAdd/SecGroupMemberDel

                    auditCol = site.Audit.GetEntries(wssQuery);

                    foreach (SPAuditEntry entry in auditCol)

                    {

                         //Execute send mail action here

                    }

                }

          -------------------------------------------------------------------------------------------------------------

         Using SharePoint Time-Job to integrate the logic  is an option, if you consider to do so, please refer:

         Timer Job(http://msdn.microsoft.com/en-us/library/bb862072.aspx)
        
    Creating Custom Timer Jobs in Windows SharePoint Services 3.0(http://msdn.microsoft.com/en-us/library/cc406686.aspx)
        
    Creating Custom SharePoint Timer Jobs (http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx)

     

         Hope this can help.

     

     Best Regards,

     -Aaron

    • Marked as answer by Chengyi Wu Friday, January 15, 2010 8:04 AM
    Monday, January 11, 2010 5:06 AM
  • Shamsul,

    A bit, late on the answer but for anyone who comes read this, it might be helpful if you change your "userNameAttribute" to "cn" (Common name), I saw that on some microsoft ldap membership provider examples, and it worked to change my people picker to display the users name and not the account name (name.lastname for example), so it might be helpful to you or anyone else who faces this problem.

    Regards,

    Richard

    Wednesday, October 20, 2010 6:58 PM