Giter Site home page Giter Site logo

Comments (6)

dsbenghe avatar dsbenghe commented on September 25, 2024

You can search for an entry in active directory with the usual ldap way using wildcards to specify all attributes and you will get all the attributes for that entry.

Microsoft should also have some docs with all the attributes - this one looks potentially ok - https://msdn.microsoft.com/en-us/library/ms675085(v=vs.85).aspx

from novell.directory.ldap.netstandard.

aniljain100 avatar aniljain100 commented on September 25, 2024

I am sorry I think I am not clear with my question. In the below code I am hard coding the attributes for adding a new entry:

           LdapAttributeSet attributeSet = new LdapAttributeSet();
            attributeSet.Add(new LdapAttribute("givenname",
                   "Anilsnew1"));
            attributeSet.Add(new LdapAttribute("sn", "Anilsnew1"));
            attributeSet.Add(new LdapAttribute("telephonenumber", "1 801 555 1212"));
            attributeSet.Add(new LdapAttribute("mail", "[email protected]"));
            attributeSet.Add(new LdapAttribute("userpassword", "Anilsnew"))
            string dn = "cn=" + user.UserName + "," + _containerName;
            sstring dn = Guid.NewGuid().ToString();
            newEntry = new LdapEntry(dn, attributeSet);
            LdapConnection conn = new LdapConnection();
            conn.Connect(_ldapHost, _ldapPort);
            conn.Bind(_loginDN, _password);
            LdapEntry ldapEntry = new LdapEntry();
            conn.Add(newEntry);

I dont want to hardcode the attribute name. How would I do it?

Thanks

from novell.directory.ldap.netstandard.

aniljain100 avatar aniljain100 commented on September 25, 2024

I found this code but its giving me 1000+ entries. I need only user attributes which are only 32 I believe.

string schemaDN = "CN=Aggregate,CN=Schema,CN=Configuration,DC=wwt-cnd,DC=local";

LdapSchema schema = _ldapConnection.FetchSchema(schemaDN);

IEnumerator attributeSchemas = schema.LDAPSchema.AttributeSchemas

from novell.directory.ldap.netstandard.

dsbenghe avatar dsbenghe commented on September 25, 2024

Not really clear for me what do you want to achieve. Ok, you could read the schema dynamically, but you still need a place where to specify what is the attribute name for "first name" or "last name" e.g.

{ "firstname", "givenname"},
{"lastname", "sn"} ...

The standard object classes "person", "organizationalPerson", "inetOrgPerson" and others are supposed to be the same for all the ldap servers and you can find their schema in the RFCs.

from novell.directory.ldap.netstandard.

aniljain100 avatar aniljain100 commented on September 25, 2024

Ok. While adding a new ldap entry in Active directory we add attributes like the below code in .NET:

LdapAttributeSet attributeSet = new LdapAttributeSet();
 attributeSet.Add(new LdapAttribute("givenname", "Anil Kumar"));
 attributeSet.Add(new LdapAttribute("sn", "Anil Kumar"));
attributeSet.Add(new LdapAttribute("telephonenumber", "1 801 555 1212"));
attributeSet.Add(new LdapAttribute("mail", "[email protected]"));
attributeSet.Add(new LdapAttribute("userpassword", "Anilkumar"))

I dont want to hardcode the attribute names like "givenname", "mail", "userPrincipalName" etc. There are 32 user level attributes I believe.

In other words I want to retrieve the following attribute names list

objectSid 
sAMAccountName
accountExpires
whenChanged 
countryCode 
memberOf 
uSNCreated 
cn 
sAMAccountType
sn 
primaryGroupID
userAccountCont
whenCreated 
lastLogoff 
pwdLastSet 
objectGUID 
givenName 
dSCorePropagati
objectClass 
uSNChanged 
name 
displayName 
lastLogon 
logonCount 
mail
distinguishedNa
badPasswordTime
badPwdCount 
userPrincipalName
codePage 
instanceType 
objectCategory

The user would send these attributes and its values in key value pair as input.
I will validate the attribute names sent by the user and add the values to the attribute set.

Thanks

from novell.directory.ldap.netstandard.

dsbenghe avatar dsbenghe commented on September 25, 2024

maybe this will help - it looks that this is what you want

https://serverfault.com/questions/598853/view-all-possible-attributes-of-an-objectclass-for-ldap

you will need to translate the command lines to api calls.

from novell.directory.ldap.netstandard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.