Export Groups With InternetAddress for each person in Groups


I was looking for some information on web few months ago and saw DB sample that would let you verify users in a groups done by David Jamieson.

Knowing that i had a project coming up where i needed to export groups from Domino address book into AD I downloaded the db. I modifyd the script to get the Internet address email address into txt file along with Type Group

Davids DB is here:

SAMPLE TXT OUTPUT
“[Mail Only]”,”GROUPNAME”,”INTERNET ADDRESS”

Thanks David for your sample db.

Enjoy
Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As New NotesDatabase( “”, “” )
Dim GroupView As NotesView
Dim PersonView As NotesView
Dim GroupDoc As NotesDocument
Dim PersonDoc As NotesDocument
Dim uidoc As NotesUIDocument
Dim inetnetadd As String
Dim rtitem As Variant

Dim txtServer As String
Dim txtFilename As String
Dim Nam As NotesName

‘ Get the Server of the Address Book
Dim s As New NotesSession
Forall book In s.AddressBooks
book.open “”, “”
If Book.Server”” Then
tmpServer=Book.Server
tmpFileName=Book.FileName
Exit Forall
End If
End Forall

‘ Prompt user to confirm server name and filename
txtServer = workspace.Prompt (PROMPT_OKCANCELEDIT, “Server Name”, “Server to check.”, tmpServer)
If Isempty (txtServer) Then
Exit Sub
End If

txtFilename = workspace.Prompt (PROMPT_OKCANCELEDIT, “Address Book”, “Filename on “+txtServer+”?”, tmpFilename)
If Isempty (txtFilename) Then
Exit Sub
End If

‘ Attempt to Open the server address book
If Not db.Open(txtServer, txtFilename ) Then
Msgbox “Failed to Open the Address Book”,16,”Warning”
Exit Sub
End If

‘ Get List of People
Set uidoc = workspace.CurrentDocument

‘ Work Through Groups

Set GroupView=db.GetView(“Groups”)
Set GroupDoc=GroupView.GetFirstDocument
While Not GroupDoc Is Nothing

‘ Get Group Type
Select Case GroupDoc.GroupType(0)
Case “0” : tmpGroupType=”[Multipurpose]”
Case “1” : tmpGroupType=”[Mail Only]”
Case “2”: tmpGroupType=”[Access Control List Only]”
Case “3” : tmpGroupType=”[Deny List Only]”
Case “4” : tmpGroupType=”[Servers Only]”
End Select

PeopleCount=0
Set PersonView=db.GetView(“People”)
Set PersonDoc=PersonView.GetFirstDocument
While Not PersonDoc Is Nothing
PeopleCount=PeopleCount+1
Redim Preserve PeopleList(PeopleCount)
ListName = groupDoc.ListName(0)

PeopleList(PeopleCount)=PersonDoc.FullName(0)
inetnetadd = PersonDoc.Internetaddress(0)
fileNum% = Freefile()
fileName$ = “C:\Users\Public\Documents\InternetAddressFromGroupsMembers.txt”
Open FileName$ For Append As fileNum%
Write #fileNum% , tmpGroupType, ListName ,inetnetadd
Close fileNum%
Set PersonDoc=PersonView.GetNextDocument(PersonDoc)

Wend
Set GroupDoc=GroupView.GetNextDocument(GroupDoc)
Wend
End Sub

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s