Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Identifying the folder of a message in the all Document View

63 views
Skip to first unread message

bruno

unread,
Oct 5, 2005, 4:47:52 PM10/5/05
to
I everybody,
In the All Document view of a lotus-notes e-mail, you can see every mail,
whatever the folder they are stored in.
It would be very usefull within this view to identify, for a given email the
folder where it is stored. I have investigate but have not found any
solution. Is there someone able to help me, perhaps is it possible with a
code ?

In advance thank you very much for your help.

Bruno from Lyon


gro...@gmail.com

unread,
Oct 6, 2005, 10:46:15 AM10/6/05
to
I think u will need a LotusScript agent and use the FolderReference
Property of NotesDocument Class to see what Folder a Mail is in.

KAI

Michel

unread,
Oct 6, 2005, 9:18:57 PM10/6/05
to
Bonjour Bruno,

For this you will have to activate the folder reference option in your
mailfile. A word of warning, this will increase the size of the mailfile
and increase processing to keep track of all newly added records. By how
much is anyones guess but I wouldn't apply this at large before you test
it with a couple of mailfiles.

You will have to create a couple of agents. Add them first to your
mailfile design and not to the template that all the mailfiles are
refering to or else they will automatically receive them at the next
design push which is about every night.

The first agent will determine if folder references is enabled and if
not will issue a message and enable it then will update all records to
initialize the folder reference for each record. Two new hidden views
will be created ($FolderInfo and $FolderRefInfo) where LN saves the
folder references tags. To see your hidden view, hold down "Left-Ctrl"
and "Left-Shift" while doubl-clicking on your Mail Icon to open it.

Here is the first Agent...
Name: Refresh All Docs
Shared
Trigger: On Event / on Action menu Selection
Target: None
'(Initialize)
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim dc As NotesDocumentCollection
Set session = New NotesSession
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Messagebox " Folder Refrences are not enabled"
Messagebox " Enabling Folder Refrences"
EnableRefs
End Sub
'(EnableRefs)
Sub EnableRefs
On Err Goto errtag
Dim ses As New NotesSession
'Set maildb = ses.CurrentDatabase
Dim vu As NotesView, folder As NotesView
Set vu = ses.CurrentDatabase.GetView(" ($FolderInfo)")
Dim vudoc As NotesDocument
Dim vuname
Dim col As NotesViewEntryCollection
Set vudoc = vu.GetFirstDocument( )
Do Until vudoc Is Nothing
vuname = vudoc.GetItemValue("$Title")
If Isarray(vuname) Then
Print "Vuname = " & Join(vuname, "|")
vuname = vuname(Ubound(vuname))
End If
If Instr(vuname, "|" ) Then vuname = Trim(Strrightback(vuname,"|"))
Print " Processing folder: " & vuname
Set folder = ses.CurrentDatabase.GetView(vuname)
Set col = folder.AllEntries
Print "Putting " & col.Count & " documents in " & vuname
Call col.PutAllInFolder(vuname)
Set vudoc = vu.GetNextDocument(vudoc)
Loop
Exit Sub
errtag:
Msgbox "Error: " & Err & " Line: " & Erl & ": " & Error
Exit Sub
End Sub

Now this next agent does the search. It's limited to find the first
occurence of Folder found. It the mail is in multiple folders, you'll
have to tinker with the code to list the full list of folders.
You point on the mail you want to do the search on (in All Documents of
course). Then call up the agent from the Action menu.

Here is the second and last agent...
Name: Search in Folders
Type: Shared
Trigger: On Event / Action menu selection
Target: All selected documents

'(Options)
Option Public
Option Declare
'(Declarations)
Dim i As Integer
'(Initialize)
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim dc As NotesDocumentCollection
Set session = New NotesSession
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
If Not(db.FolderReferencesEnabled) Then
Messagebox " Folder Refrences are not enabled"
Messagebox " Enabling Folder Refrences"
EnableRefs
End If
While Not(doc Is Nothing)
i=0
Forall folderreference In doc.FolderReferences
i=i+1
Print doc.subject(0), " in Folder: " , FolderReference
Messagebox "found in : " & FolderReference
End Forall
Set doc= dc.GetNextDocument(doc)
Wend
End Sub
'(EnableRefs)
Sub EnableRefs
On Err Goto errtag
Dim ses As New NotesSession
'Set maildb = ses.CurrentDatabase
Dim vu As NotesView, folder As NotesView
Set vu = ses.CurrentDatabase.GetView(" ($FolderInfo)")
Dim vudoc As NotesDocument
Dim vuname
Dim col As NotesViewEntryCollection
Set vudoc = vu.GetFirstDocument( )
Do Until vudoc Is Nothing
vuname = vudoc.GetItemValue("$Title")
If Isarray(vuname) Then
Print "Vuname = " & Join(vuname, "|")
vuname = vuname(Ubound(vuname))
End If
If Instr(vuname, "|" ) Then vuname = Trim(Strrightback(vuname, "|" ))
Print " Processing folder: " & vuname
Set folder = ses.CurrentDatabase.GetView(vuname)
Set col = folder.AllEntries
Print "Putting " & col.Count & " documents in " & vuname
Call col.PutAllInFolder(vuname)
Set vudoc = vu.GetNextDocument(vudoc)
Loop
Exit Sub
errtag:
Msgbox "Error: " & Err & " Line: " & Erl & ": " & Error
Exit Sub
End Sub


Have fun playing with the code.

Michel de Montréal

bruno

unread,
Oct 11, 2005, 1:24:40 PM10/11/05
to
Merci Infiniment Michel, c'est très sympa de ta part.

I'am going to try and apply.
Thanks again,
Greetings


bruno

unread,
Oct 11, 2005, 1:27:08 PM10/11/05
to
Merci beaucoup, Kai,

0 new messages