Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to send document in database to multiple persons listed?

Posted on 2004-09-13
9
Medium Priority
?
305 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 200 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 80 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

730 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