Object Interface for Query Based Distribution Group



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

.



Relevant Pages

  • Help Creating AD Users and Groups.
    ... I'm trying to use directoryservices to create a user account and a distribution group and set the attributes here is my code: The User account and group is created, but some property fields are working except the one ... Dim cmplususr As String ...
    (microsoft.public.dotnet.languages.vb)
  • Search pattern
    ... Dim strfile As String ... Dim bAddressFound As Boolean ... Dim strCurrentChar As String ...
    (comp.databases.ms-access)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Help answer these 70-310 questions
    ... One argument is the string ... Dim output As New StringBuilder ... EmployeeLocations. ... You create a strongly named serviced component. ...
    (microsoft.public.cert.exam.mcad)