Solved

How to send document in database to multiple persons listed?

Posted on 2004-09-13
9
304 Views
Last Modified: 2013-12-18
I have a form and in this form, there is an editable Readers field - AuthorizedReader with default value - @UserName.
I created a button - MailSend so that when the author create this document, he/she will click on this button to send to all the person listed in the AuthorizedReader field.
My formula for the button works only when 1 username is in this field. If there are multiple users in this AuthorizedReader field, it give me this msg-> Document has been send to authorized readers! and follow by this error -> Unable to send mail, no match found in Name & Address Book(s). But the names listed are correct.

Formula for MailSend button:
Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc=ws.CurrentDocument
      Call uidoc.save
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim newDoc As NotesDocument
      Dim curdoc As notesdocument
      Dim rtitem As NotesRichTextItem
      Dim dateTime As New NotesDateTime("")
      Set db = session.CurrentDatabase
      Set curdoc = uidoc.document
      Set newDoc = New NotesDocument( db )
      Set rtitem = New NotesRichTextItem( newDoc, "Body" )
      Call rtitem.AppendText( "New Meeting document added! Please follow this document link to view the meeting details" )
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendDocLink( curdoc, db.Title )
      Messagebox ("Document has been send to authorized readers!")
      Call uidoc.Close
      Call newdoc.Send(False,uidoc.FieldGetText("AuthorizedReader"))
      Call ws.ViewRefresh
End Sub

Pls help.
Thank you very much.

0
Comment
Question by:kopibean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 19

Accepted Solution

by:
madheeswar earned 50 total points
ID: 12051458
try this:
Sub Click(Source As Button)
     Dim ws As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Set uidoc=ws.CurrentDocument
     Call uidoc.save
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim newDoc As NotesDocument
     Dim curdoc As notesdocument
     Dim rtitem As NotesRichTextItem
     Dim dateTime As New NotesDateTime("")
dim item as notesitem
     Set db = session.CurrentDatabase
     Set curdoc = uidoc.document
     Set newDoc = New NotesDocument( db )
set item=curdoc.getfirstitem("AuthorizedReader")
     Set rtitem = New NotesRichTextItem( newDoc, "Body" )
     Call rtitem.AppendText( "New Meeting document added! Please follow this document link to view the meeting details" )
     Call rtitem.AddNewLine( 2 )
     Call rtitem.AppendDocLink( curdoc, db.Title )
dim x as integer
For x=0 to Ubound(item.values)
     Call newdoc.Send(False,item.values(x))
print "Mail Send to: "&cstr(item.values(x))
next
     Messagebox ("Document has been send to authorized readers!")
     Call uidoc.Close

     Call ws.ViewRefresh
End Sub
0
 

Author Comment

by:kopibean
ID: 12051585
The above works!!
I forgot I need to add in the subject ->
newdoc.Subject = "<From XXX DB>" + "[" + uidoc.FieldGetText("category") + "]" + uidoc.FieldGetText("subject")
Where do I place this code at?

Pls advise!
THanks!
0
 
LVL 15

Assisted Solution

by:Bozzie4
Bozzie4 earned 20 total points
ID: 12051664
Actually, you now send separate mails.  You can do the same in 1 memo.

newdoc.SendTo = uidoc.document.AuthorizedReader
' newdoc.CopyTo = uidoc.document.AuthorizedReader ' to put them all in copy or blindcopy , is a good idea.

...

Call newdoc.send( False, curdoc.AuthorizedReader) ' I generally do it double (use sendto field, and put the to's here, because it works better for me)

for subject, use :

newdoc.Subject = "<From " +  uidoc.document.parentdatabase.title + " DB>" + "[" + uidoc.document.category(0) + "]" + uidoc.document.subject(0)

And you may have noticed I don't use curdoc.  I find it better to use uidoc.document throughout your code (in a button like this), because then you are sure the Notes Document object is in sync with the frontend NotesUIDocument.

cheers,

Tom Bosmans
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:madheeswar
ID: 12051678
Tom,
what you said is correct. I agree.
If the requirment is something like other perosns name should not be listed, then my approach is the only option. BCC is not an option.

0
 

Author Comment

by:kopibean
ID: 12051740
I place the subject after this line ->

Call newdoc.Send(False,item.values(x))
newdoc.Subject = "<From " +  uidoc.document.parentdatabase.title + " DB>" + "[" + uidoc.document.category(0) + "]" + uidoc.document.subject(0)
Print "Mail Send to: "&Cstr(item.values(x))

but the subject in my inbox show nothing?
Did I place the subject code wrong?

Pls advise.
Thanks!


      
0
 

Author Comment

by:kopibean
ID: 12051746
Opps...I know where to place the subject header....
thanks madheeswar and tom!!
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12052223
then increase the points & Grade "A" and accept.

-Thanks
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12053442
Why would bcc not be an option ?  It works great, the only thing you need to do is put a bogus /fake address in the sendto field  !

cheers,

Tom
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12061491
TOM,
I want to display one name in To field and no names in other fields(CC/BCC).

So, then my approach is correct right. I had this requirement in my previous company.

0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question