C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Wednesday, June 27, 2012

C#.Net - Connect LDAP - Issue in add/remove group

I am developing an automated process that Add/Remove groups from particular account in LDAP based on condition.
I have used C#.Net and used Directory entry namespace for LDAP connection. I have SQL Server connection and gets all the Group distinguished names from database.
I followed below steps:
1.  Connect to LDAP
2.  Filter particular Account
3.  Get member of Property
4.  Add Group (Add Group distinguished name)
5.  Close connection.
I am able to read but not write the group.
When I try to add group, it throws below error.
Error: General –Access denied.
Note: User ID and Password has ADMIN rights for particular OU.
I have below code for LDAP connectivity.
de = New DirectoryEntry(domainADsPath + "/dc=vds,dc=enterprise", username, password, AuthenticationTypes.None)
I tried all the authentication types.
My user id and password all the ADMIN rights. Still I am not able to add group
I have below code for adding group
OpenConnection()
GroupADSPath=”CN=FS-DiabetesTest,OU=Groups,OU=Users,OU=US 55 Corporate,ou=pharma,dc=vds,dc=enterprise”
            de.Properties("memberof").Add(GroupADSPath)
            de.CommitChanges()
            de.Close()
            ‘Here Group name is FS-DiabetesTest
Any Help?

No comments:

Post a Comment