Split errors - object not found and unknown error

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-size:small <span style="font-size:small
I have the code below giving me grief because it gives unknown error <span style="font-size:small (0x80005000) when trying to add a user to a second group:

<pre class="prettyprint lang-vb AD = New DirectoryEntry(Trim("LDAP://OU=Topou,OU=Staff,DC=garrard,DC=ketsds,DC=net"), "", "", AuthenticationTypes.Secure)
AD2 = New DirectoryEntry(Trim("LDAP://OU=_Exchange Resources,OU=Staff,DC=garrard,DC=ketsds,DC=net"), "", "", AuthenticationTypes.Secure)
ADFind = New DirectorySearcher(AD)
groupname = "Lancaster Elementary Teachers"
group = AD2.Children.Find("CN=" + Trim(groupname))
ADFind.Filter = ""
results = Nothing
Add a single user to a group;
ADFind.Filter = "(&(objectCategory=user)(cn=" + userID + "))"
results = ADFind.FindOne
DN = results.Properties("distinguishedName").Item(0).ToString()
group.Properties("member").Add(DN)
group.CommitChanges()[/code]
Also, I have another error in the same code block which is the same sub that gives me a completely different error - their is no such object on the server:
<pre class="prettyprint lang-vb Dim results1 As SearchResult
AD = New DirectoryEntry("LDAP://OU=TopOu,OU=Staff,DC=garrard,DC=ketsds,DC=net", "", "", AuthenticationTypes.Secure)
AD2 = New DirectoryEntry("LDAP://OU=_Exchange Resources,OU=Staff,DC=garrard,DC=ketsds,DC=net", "", "", AuthenticationTypes.Secure)
ADFind = New DirectorySearcher(AD)
ADFind.Filter = ""
groupname = "Garrard Co MS Teachers"
ADFind.Filter = "(&(objectCategory=user)(cn=" + userID + "))"
group = AD2.Children.Find("CN=" + groupname)
Add a single user to a group;
results1 = ADFind.FindOne
DN = results.Properties("distinguishedName").Item(0).ToString()
group.Properties("member").Add(DN)
group.CommitChanges()[/code]
<br/>





<
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog
- http://jefferycarlsonblog.blogspot.com/
<br/>
<br/>

View the full article
 
Back
Top