| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
This example lists the groups in an Exchange 2000 information store. This example opens group information in the Active Directory using ADSI. It then uses the IMailRecipient interface aggregated onto the ADSI.group object to access information in the Web Store.
Sub List_Groups(ServerName As String, DomainName As String)
'ServerName is something like "MyServer6"
'DomainName is something like "DC=MYDOMAIN3,DC=microsoft,DC=com"
Dim objGroup As IADsGroup
Dim objContainer As IADsContainer
Dim objRecip As CDOEXM.MailRecipient
Dim i As Long
Dim name As String
On Error GoTo Error
' get the container
Set objContainer = GetObject("LDAP://" + ServerName + "/" + _
"CN=users," + DomainName)
objContainer.Filter = Array("Group")
i = 0
Debug.Print
For Each objGroup In objContainer
name = objGroup.name
name = Right(name, Len(name) - 3)
Set objRecip = objGroup
If objRecip.TargetAddress = "" And objRecip.X400Email = "" Then
Debug.Print name + " (mail disabled)"
Else
Debug.Print name + " (mail enabled)"
End If
i = i + 1
Next
Debug.Print "Number of groups found in the DS (in the default container): " + Str(i)
GoTo Ending
Error:
Debug.Print "Failed while displaying the groups in the default container."
MsgBox "Run time error: " + Str(Err.number) + " " + Err.Description
Err.Clear
Ending:
End Sub