Consuming LDAP Property Mappings in user control - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Consuming LDAP Property Mappings in user control

  • Consuming LDAP Property Mappings in user control
  • How can I consume a new LDAP property mapping object in a user control? There is a few fields that I would like to access that I am not sure how. 
  • did you ever figure this out? is there any docs that describe how to get LDAP properties from Sitefinity?
  • Hi all,


    I believe we discussed a similar topic in our support thread correspondence. It concerned how to get LDAP Property Mappings in a Custom UserProfile field. The methodology of adding them to a user control is the same. Basically you will need to get the mapping via the configurations of your LDAP and then you are free to manipulate the data retrieved. Here is the sample from the support thread:

    "For the sake of this sample the property names you define in the Sitefintiy LDAP user mappings should contain the "profile_" prefix and have the same names as the fields in the user profile. So for example if you want to synchronize the custom field "Country" in the user profile with the country information form your AD, when you define the mapping for this LDAP field you have to name your property "profile_Country"." 

    var userManager = UserManager.GetManager("LdapUsers");
                var users = userManager.GetUsers();
                var ldapFacade = new LdapFacade();
                var mapping = Config.Get<SecurityConfig>().LdapConnections.LdapMapping.UserMapping;
                var ldapProfileMappingKeys = mapping.PropertiesMapping.Keys.Where(k => k.Contains("profile_"));
                foreach (var user in users)
                    var ldapUser = ldapFacade.GetUserById(user.Id, new string[1]);
                    Dictionary<string, string> profileFieldsProxy = new Dictionary<string, string>();
                    foreach (var key in ldapProfileMappingKeys)
                        var fieldValue = LdapUtilities.GetAttributeValue<string>(ldapUser, mapping.GetLdapFieldName(key));
                        profileFieldsProxy.Add(key.Replace("profile_", ""), fieldValue);

    Ivan D. Dimitrov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.