Solved

How to send document in database to multiple persons listed?

Posted on 2004-09-13
9
302 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
Technology Partners: 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 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