Hi,
I'm trying to do some LDAP coding through VB6 and I don't seem to be getting anywhere.
I'm trying to get a list of recipients from an active directory. I'm using the following code to get to grips with the idea and I don't seem to be able to get it to work:
Dim RecipObj As IADs
Dim memberOf As Variant
Set RecipObj = GetObject("LDAP://systems-dc/o=Exchange/cn=recipients"
memberOf = RecipObj.Get("memberOf"
If IsArray(memberOf) Then 'User is on more than one DL
For Each member In memberOf
Debug.Print member
Next
Else
Debug.Print memberOf
End If
I pinched this off the MS Knowledge base but I'm not sure I'm using the GetObject function correctly. On the exchange site it also wants me to pass an "ou" parameter and two cn parameteres but I'm not sure what they are.
The error I get with this code is:
Run-time Error: -2147016672 (80072020)
Automation Error
An operations error occurred
I'm trying to do some LDAP coding through VB6 and I don't seem to be getting anywhere.
I'm trying to get a list of recipients from an active directory. I'm using the following code to get to grips with the idea and I don't seem to be able to get it to work:
Dim RecipObj As IADs
Dim memberOf As Variant
Set RecipObj = GetObject("LDAP://systems-dc/o=Exchange/cn=recipients"
memberOf = RecipObj.Get("memberOf"
If IsArray(memberOf) Then 'User is on more than one DL
For Each member In memberOf
Debug.Print member
Next
Else
Debug.Print memberOf
End If
I pinched this off the MS Knowledge base but I'm not sure I'm using the GetObject function correctly. On the exchange site it also wants me to pass an "ou" parameter and two cn parameteres but I'm not sure what they are.
The error I get with this code is:
Run-time Error: -2147016672 (80072020)
Automation Error
An operations error occurred