|
|
|
|
|
|
|
|
|
|
|
|
|
|
Working with folders in mail and how to find lost documents (continued)
01 Dim sess As New notessession
02 Dim db As notesdatabase
03 Set db = sess.currentdatabase
04 db.FolderReferencesEnabled = True
05 Dim docs As NotesDocumentCollection
06 Dim doc As NotesDocument
07 Set docs = db.unprocesseddocuments
08 Set doc = docs.getfirstdocument
09
10 While Not(doc Is Nothing)
11 Forall folder In doc.FolderReferences
12 If folder <> "" Then
13 Print doc.subject(0) & " -> folder: " & folder
14 End If
15 End Forall
15 Set doc = docs.GetNextDocument(doc)
16 Wend
|
Again, in line 4 we make sure that we have FolderReferences enabled on the database. By the time we get to line 10 we already have a collection of all selected documents in the view -- db.unprocesseddocuments in line 8 and have got the first one. In line 11 we start to look at the set of folderreferences per document, and in line 12 we make sure that we ignore ones with no value. All non-blank folder references are printed in line 13.
OK, I said this was crude. Your implementation will of course have a complete and polished UI, but I wanted to deal just with the core code.
In a real implementation you will need to pay attention to one or two other things. Firstly, the Sent "folder" is actually a view, not a folder, so this code won't report items that are just in the Sent view. If seeing them is important, then you will need to check the same field items on each document as are used in the Sent view's selection formula. The view selection is:
SELECT DeliveredDate = "" & PostedDate != "" & !(@IsMember("S"; ExcludeFromView))
|
A LotusScript equivalent could be:
n = evaluate({@ismember("S",ExcludeFromView}), doc)
if not (doc.hasitem(doc.delivereddate)) and doc.hasitem(posteddate) and n <> 0 then... 'document will be in the Sent view
|
You will also probably want to translate view names like ($Inbox) and ($JunkMail) back to the folder names that are used in the mail database UI as specified in the various Outlines in the mail database, to give a consistent look and feel to the whole experience, should you add this code to the mail database. My customer, who took this code and extended it, also reports that on rare occasions accessing a document's FolderReferences raised error 17412, so you might want to add a trap for that.
And, of course, you will invent a complete UI to manage the user experience, won't you?
Have fun, and good hunting!
David Gewirtz is the author of How To Save Jobs and Where Have All The Emails Gone? For more than 20 years, he has analyzed current, historical, and emerging issues relating to technology, competitiveness, and policy. David is the Editor-in-Chief of the ZATZ magazines, is the Cyberterrorism Advisor for the International Association for Counterterrorism and Security Professionals, and is a member of the instructional faculty at the University of California, Berkeley extension. He can be reached at david@zatz.com and you can follow him at http://www.twitter.com/DavidGewirtz.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.
Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.
Learn how to easily clean up your address book. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|