This project has moved. For the latest updates, please go here.

LDAPAttributeToDisplayProp not working

Aug 29, 2016 at 6:04 PM
Hi there,

i've created a custom ldapcp class with following config
LDAPCPConfig myConfig = LDAPCPConfig.GetDefaultConfiguration();
myConfig.FilterEnabledUsersOnlyProp = true;
myConfig.FilterSecurityGroupsOnlyProp = true;
//myConfig.DisplayLdapMatchForIdentityClaimTypeProp = true;

myConfig.AttributesListProp = new List<AttributeHelper>
{
    new AttributeHelper
    {
        LDAPAttribute="sAMAccountName",
        LDAPObjectClassProp="group",
        ClaimType=WIF.ClaimTypes.Role,
        ClaimEntityType=SPClaimEntityTypes.FormsRole
    },
    new AttributeHelper
    {
        LDAPAttribute="userPrincipalName",
        LDAPObjectClassProp="user",
        ClaimType=WIF.ClaimTypes.Upn,
        ClaimEntityType=SPClaimEntityTypes.User,
        EntityDataKey=PeopleEditorEntityDataKeys.Email,
        LDAPAttributeToDisplayProp="displayName"
    }
};

return myConfig;
but there is allways the upn in people picker... not the displayname...

what I'm doing wrong? :(
Coordinator
Aug 30, 2016 at 4:43 PM
Hi,
you can troubleshoot this by monitoring ULS logs and filter on product/area "LDAPCP"
You can set to verbose to get detailed information
Aug 31, 2016 at 11:54 AM
Edited Aug 31, 2016 at 11:54 AM
Hi Yvand,

there are no errors showing in ULS Log...
All metadata added correctly!
But in "Created permission:... " the display text is still the upn:
[Axxx_LDAPCP] Got 3 result(s) from all LDAP server(s) with query "(| (&(objectclass=user)(userPrincipalName=dmxxx*)) (&(objectclass=group)(sAMAccountName=dmxxx*)) (&(objectclass=user)(displayName=dmxxx*)) (&(objectclass=user)(cn=dmxxx*)(!(objectClass=computer))) (&(objectclass=user)(sn=dmxxx*)) )"
[Axxx_LDAPCP] 3 permission(s) to create after filtering
[Axxx_LDAPCP] Added metadata "Email" with value "dmxxx@fxxx.de" to permission
[Axxx_LDAPCP] Added metadata "DisplayName" with value "Dominic Mxxx" to permission
[Axxx_LDAPCP] Added metadata "Title" with value "internal IT" to permission
[Axxx_LDAPCP] Added metadata "SIPAddress" with value "SIP:dmxxx@fxxx.de" to permission
[Axxx_LDAPCP] Added metadata "WorkPhone" with value "+497xxx" to permission
[Axxx_LDAPCP] Created permission: display text: "dmxxx@fxxx.de", value: "dmxxx@fxxx.de", claim type: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn", and filled with 5 metadata.
changed some data with "xxx"
Coordinator
Sep 5, 2016 at 1:36 PM
Hi, this is perfectly normal: AttributeHelper is created with property ClaimType set to WIF.ClaimTypes.Upn, so permissions will be created with this claim type.
Property LDAPAttributeToDisplayProp (which you set to "displayName") defines the display of the permission in the people picker, but it doesn't affect the real value of the permission, that is the value of the UPN of the user (LDAPAttribute="userPrincipalName").
I hope it makes sense.
Sep 5, 2016 at 1:42 PM
Hi Yvand,

okay... but in the people picker displays the upn and not the displayName...
Coordinator
Sep 5, 2016 at 1:45 PM
Hmm, can you try on a new site collection?
I suspect you get this display from a cache, and not from what LDAPCP actually provides...
Sep 8, 2016 at 9:09 AM
I fixed it by changing
EntityDataKey=PeopleEditorEntityDataKeys.Email
to
EntityDataKey=PeopleEditorEntityDataKeys.DisplayName
Is this the right way? :D
Coordinator
Sep 14, 2016 at 12:42 PM
Actually, not really, you should try this instead:
myConfig.AttributesListProp = new List<AttributeHelper>
{
    new AttributeHelper
    {
        LDAPAttribute="sAMAccountName",
        LDAPObjectClassProp="group",
        ClaimType=WIF.ClaimTypes.Role,
        ClaimEntityType=SPClaimEntityTypes.FormsRole
    },
    new AttributeHelper
    {
        LDAPAttribute="userPrincipalName",
        LDAPObjectClassProp="user",
        ClaimType=WIF.ClaimTypes.Upn,
        ClaimEntityType=SPClaimEntityTypes.User,
        EntityDataKey=PeopleEditorEntityDataKeys.Email,
        LDAPAttributeToDisplayProp="displayName"
    },  
    new AttributeHelper
    {
        LDAPAttribute="displayName", 
        LDAPObjectClassProp="user", 
        EntityDataKey=PeopleEditorEntityDataKeys.DisplayName
    },
};