Hi,
I have a view. In that view i have an action button “Approve”. User can select as many documents as he can. What my requirement is when user selects some documents, i have to go into each document and take the name of the requestor and send a mail to him with some subject. I am able to send mail, if there are 10 documents selected i am sending 10 mails. I dont want that to happen, any number of documents selected i want to send only one mail to all requestors. That is i have to capture all requestor names in some array for all selected documents. Can anyone tell me the code for that.
Thanks in advance.
Subject: Send Mails
hi narsimha
you gather all the selected documents in a collection (the property “documents” of the notesuiview class)
you create a new memo
for each selected document you get the name of the recipient and add it to the field “sendto” of your memo
you fill in your subject as desired
you send your memo
this is an agent i created that is similar to what you’re trying to achieve
you’ll have to modify it a bit to adapt it to your purpose
cheers
Dim mailDB As New NotesDatabase( "", "" )
Dim memo As notesdocument
Dim db As notesdatabase
Dim s As New notessession
Dim w As New notesuiworkspace
Dim doc As notesdocument
Dim uiview As NotesUIView
Dim dc As NotesDocumentCollection
Dim sendTo As NotesItem
Set db = s.currentdatabase
Set uiview = w.CurrentView
Set dc = uiview.Documents
Set doc = dc.GetFirstDocument
' If no documents were selected, end of agent
If doc Is Nothing Then
Msgbox "No documents were selected", 48
Exit Sub
End If
Call mailDB.OpenMail
Set mailDoc = mailDB.createdocument
mailDoc.Form="memo"
mailDoc.ReplyTo = s.commonusername
mailDoc.From = s.commonusername
Set sendTo = New NotesItem( mailDoc, "SendTo", "")
While Not (doc Is Nothing)
Call sendTo.AppendToTextList(doc.Name(0))
Set doc = dc.GetNextDocument (doc)
Wend
Call uiview.DeselectAll
Call mailDoc.Save(True, True)
Set mailUI = w.EditDocument(True, mailDoc)