Solved

How to send document in database to multiple persons listed?

Posted on 2004-09-13
9
292 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
  • 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now