Quantcast
Viewing all articles
Browse latest Browse all 31638

Active Directory Extended Attributes

Hi,

I have created new extended attributes in Active directory and linked them with user class, however from my c# code I couldn’t be able to access them. Here is the snippet of the code. Do I need to give special permission to user that is trying to access these attributes?

using (DirectoryEntry de = new DirectoryEntry(path, username, password, AuthenticationTypes.Secure | AuthenticationTypes.Sealing))
{
        //Context.Response.Write("2a"); 
        DirectoryEntries users = de.Children;
        DirectoryEntry user = users.Add("CN=" + MemberAdminName, "user");
        //Context.Response.Write("3a"); 

        user.Properties["description"].Add("Sharepoint user account - Initial Member Admin");
        user.Properties["sAMAccountName"].Add(MemberAdminName);
        user.Properties["givenName"].Add(FirstName);
        user.Properties["sn"].Add(LastName);
        user.Properties["company"].Add(LastName);
        user.Properties["DisplayName"].Add(FirstName + " " + LastName);
        if (user.Properties.Contains("memberEmail"))
        {
                user.Properties["memberEmail"].Add(email);
        }
        if (user.Properties.Contains("mail"))
        {
                user.Properties["mail"].Add(email);
        }
        if (user.Properties.Contains("memberAdmin"))
        {
                user.Properties["memberAdmin"].Add(true);
        }
        if (user.Properties.Contains("buAdmin"))
        {
                user.Properties["buAdmin"].Add(false);
        }
        if (user.Properties.Contains("buCreateTimeStamp"))
        {
                user.Properties["buCreateTimeStamp"].Add(createDateTime);
        }

        user.CommitChanges();
}

Many thanks,



Viewing all articles
Browse latest Browse all 31638

Trending Articles