Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



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

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate 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

'PUT THESE IN THE DECLARATIONS SECTION
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

'Constants
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)
Loop
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. http://www.billbuchan.com/web.nsf/htdocs/BBUN67JJCV.htm

Thanks to Stan Rogers who wrote a very similar agent that I used as a starting point: http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/8c6522b1bd6065b5852570cb007fdb4c?OpenDocument

Kevin
http://www.lotusguru.com




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
Author
Category
Platform
Release
Advanced search

Sign In or Register

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

Member Tools


RSS Feeds

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

Resources

 Resources
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

Wikis

 Wikis
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