Manage Learn to apply best practices and optimize your operations.

Search Mail Folders By UNID

A user often copies mail to various folders using citeria such as sender or subject then needs to know which folders contain copies of a specific email. This agent searches all folders using the unique ID of the selected document. The mail must have been copied by dragging and dropping (cutting and pasting creates a new UNID). It runs from the Actions menu on Selected Documents.

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim Counter As Integer
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim tempDoc As NotesDocument
Dim ID As String
Dim MsgText As String

Set db = session.CurrentDatabase

'From an agent, the UnprocessedDocuments property of NotesDatabase will contain all selected documents Set dc = db.UnprocessedDocuments

'Get the UNID of the selected document Set doc = dc.GetFirstDocument ID = doc.UniversalID

'Set initial variables for the search Counter = 1 MsgText="Found in these folders: "

'Go through all folders and find documents that have the same UNID Forall v In db.Views If v.IsFolder Then Set tempDoc = v.GetFirstDocument Do While Not (tempDoc Is Nothing) If tempDoc.UniversalID = ID Then MsgText=MsgText + Chr(13) + Str(Counter) +") " + v.Name Counter = Counter + 1 Exit Do End If Set tempDoc = v.GetNextDocument(tempDoc) Loop End If

End Forall

'Display names of folders If Counter = 1 Then Messagebox "Document not found in any folder. " Else Messagebox MsgText End If

End Sub

Dig Deeper on Domino Resources - Part 6



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...