Wondering if anyone knows when you are trying to add a user to a group in an LDAP if there is a way to add the member into the uniquemember attribute instead of member attribute. My VB.Net code to add a member to a group using System.DirectoryServices
is below but it adds the member to the group using the member attribute. We want to try and add user into the uniquemember attribute. I am trying to use the System.DirectoryServices namespace in the .Net 1.1 Framework and using invoke command interoping
over to ADSI to use the add command. Using an iPlanet LDAP Server if it matters. Anybody know any other way that can add a user via the uniquemember attribute?
htLDAP = AppSettings.GetLDAPConnectionString
mstrLDAPPwd = Me.GetLDAPPassword
mstrLDAPName = htLDAP("LDAP")
strLDAPOU = htLDAP("LDAPOU")
strGroupOU = AppSettings.GetLDAPGroupOU
Dim objRoot As DirectoryEntry =
New DirectoryEntry("LDAP://" & mstrLDAPName & "/" & strGroupOU)
objRoot.Username = htLDAP("LDAPUserName")
objRoot.Password = mstrLDAPPwd
Dim objSearcher As DirectorySearcher =
New DirectorySearcher(objRoot)
objSearcher.Filter = "(cn=" & strGroupName & ")"
Dim grpSearch As SearchResult = objSearcher.FindOne()
Dim grp As DirectoryEntry =
New DirectoryEntry(grpSearch.Path, htLDAP("LDAPUserName"), mstrLDAPPwd, AuthenticationTypes.Delegation)
Dim objUser As
New DirectoryEntry("LDAP://" & mstrLDAPName & "/uid=" & strUid & "," & strLDAPOU, htLDAP("LDAPUserName"), mstrLDAPPwd)
Dim blnIsMember As
Boolean = Convert.ToBoolean(grp.Invoke("IsMember",
New Object() {objUser.Path}))
If blnIsMember Then