Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

RE: How to find List of Users in the Names & Address Books who have MailForward checked on
Kevin Pettitt 30.Jan.07 06:03 PM a Web browser
Domino Administrator All Releases All Platforms

1 - Create a Lotusscript agent, action menu triggered, target - none (in any database)
2 - Import the following code:

Option Public
Option Declare

Dim s As NotesSession
Dim domdir As NotesDatabase
Dim personName As NotesName
Dim personList List As String
Dim MailAddress As String
Dim fileID As Integer
Dim filePath As String

Const domdirserver$ = "YOURSERVERNAMEHERE"

Sub Initialize

Set s = New NotesSession
Set domdir = s.GetDatabase(domdirserver$, "names.nsf")
'That assumes the agent runs in the NAB
'use GetDatabase if it's running in another DB
Call PopulatePersonList
fileID = Freefile
filePath = "C:\Temp\ForwardedAccounts.txt"
If Dir(filePath) <> "" Then Kill filePath
Open filePath For Output As fileID
Forall account In personList
Set personName = New NotesName(Listtag(account))
Print #fileId, personName.Abbreviated & " - " & account
End Forall
Close fileID
'Create and send notification
Dim mailDoc As New NotesDocument(domdir)
Call mailDoc.ReplaceItemValue("SendTo","YOUR NAME (CN) HERE")
Dim body As New NotesRichTextItem(mailDoc, "Body")
Call body.AppendText("Policy scan completed at " + Cstr(Now))
Call body.AddNewline(2,True)
Call mailDoc.ReplaceItemValue("Subject","Following People have forwarding addresses")
Call body.EmbedObject(EMBED_ATTACHMENT, "", filePath)
Call mailDoc.Send(False)

End Sub
Sub PopulatePersonList
'This prevents doing a real lookup for every person
'by creating a lookup table in memory
Dim peopleView As NotesView
Dim personDoc As NotesDocument
Set peopleView = domdir.GetView("($VIMPeople)")
Set personDoc = peopleView.GetFirstDocument
Do Until personDoc Is Nothing
If personDoc.GetItemValue("MailAddress")(0) <> "" Then
'Only populate the list if the person has a forwarding address
personList(personDoc.GetItemValue("FullName")(0)) = personDoc.GetItemValue("MailAddress")(0)
End If
Set personDoc = peopleView.GetNextDocument(personDoc)
End Sub

3 - Change the bits in the code that reference a servername for the domino directory and your own personal email/notes name
4- Run agent. You will be mailed a text file containing the abbreviated names of everyone in your corporate NAB/domino directory who has a forwarding address, along with that address.
5 - Tweek the code as you wish to change the output method, send to a group, whatever. If you put this into the NAB itself, you can skip the bits about referencing a specific server, and just use set domdir = s.currentdatabase

Thanks to Bill Buchan for his great promotion of Lotusscript Lists which made this possible/easy.

Thanks to Stan Rogers who wrote a very similar agent that I used as a starting point:


How to find List of Users in the Na... (ac ac 30.Jan.07)
. . RE: How to find List of Users in th... (Kevin Pettitt 30.Jan.07)

Document Options

  Document options
Print this pagePrint this page

Search this forum

Forum views and search

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

Member Tools

RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite