Object Interface for Query Based Distribution Group
- From: ZamekPetr@xxxxxxxxx
- Date: 21 Dec 2006 05:42:48 -0800
Hello, I have a problem with this code, when the selected recordset
contains a Query Based Distribution Group. Maybe IADsGroup is not valid
for this sort of object. How to manage it? Can anybody help me? Thanks.
Petr Zámek, Prague
Dim oRootDSE As IADs
Dim oConnection As New ADODB.Connection
Dim objGroup As IADsGroup
Dim RS As ADODB.Recordset
Dim oCommand As New ADODB.Command
Dim strQuery As String
Dim varDomainNC As Variant
Dim cn As String
Dim looked_cn As String
' Get the configuration naming context.
Set oRootDSE = GetObject("LDAP://RootDSE")
varDomainNC = oRootDSE.Get("defaultNamingContext")
oConnection.Provider = "ADsDSOObject"
oConnection.Open "ADs Provider"
oCommand.ActiveConnection = oConnection
strQuery = "<LDAP://" & varDomainNC & ">;(managedBy=" &
looked_cn & ");adspath;subtree"
oCommand.CommandText = strQuery
Set RS = oCommand.Execute
' Iterate through the results.
While Not RS.EOF
On Error Resume Next
Set objGroup = GetObject(RS.Fields("adspath"))
If Err Then
Debug.Print Err.Number, Err.Description
' **** ERROR by Query Based Distribution Group: 13 Type mismatch
text = text & vbCrLf & " " & "query based
distribution group ?"
Else
Debug.Print " ", objGroup.distinguishedName
text = text & vbCrLf & " " &
objGroup.distinguishedName
End If
RS.MoveNext
Wend
.
- Prev by Date: Re: Handling Errors in DLL
- Next by Date: security setting for web browser control
- Previous by thread: Re: Handling Errors in DLL
- Next by thread: security setting for web browser control
- Index(es):
Relevant Pages
|