Solved

Adding CC to Newsletter

Posted on 2008-10-20
10
262 Views
Last Modified: 2013-12-18
What would be the code to add a CC and/or a BCC to the newsletter code below.
Sub Click(Source As Button)
	Dim s As New NotesSession
	Dim w As New NotesUIWorkspace
	Dim db As NotesDatabase
	Dim v As NotesView
	Dim c As NotesDocumentCollection
	Dim doc As NotesDocument
	Dim key As String
	Dim cur As NotesDocument
	Set db = s.CurrentDatabase
	Set doc = w.CurrentDocument.Document
	key = doc.ussales(0)    'get the name of office (view category) from the current document
	Set v = db.GetView( "newsletter" ) 'maybe you'll have to create the view that is categorized by office
	Set c = v.GetAllDocumentsByKey( key, True )
	Dim newDoc As New NotesDocument( db )
	Dim rt As NotesRichTextItem
	Set rt = newDoc.CreateRichTextItem( "Body" )
	Dim rtsHeader As NotesRichTextStyle, rtsNormal As NotesRichTextStyle
	Set rtsHeader = s.CreateRichTextStyle  
	Set rtsNormal = s.CreateRichTextStyle
	
	rtsHeader.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables
	rtsHeader.FontSize = 12
	rtsHeader.Bold = True
	
	rtsNormal.NotesFont = FONT_COURIER
	rtsNormal.FontSize = 10
	rtsNormal.Bold = False
	
	Call rt.AppendStyle( rtsHeader )
	
	Call rt.AddNewLine( 3 )
	Call rt.AppendText( "Employee #" )
	Call rt.AddTab( 1 )
	Call rt.AppendText( "Current Asset" )
	Call rt.AddTab( 2 )
	Call rt.AppendText( "New Asset " )
	Call rt.AddTab( 2 )
	Call rt.AppendText( "New  Mon Asset" )
	Call rt.AddNewLine( 1 )
	
	Call rt.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header
	
	Set cur = c.GetFirstDocument
	Do Until cur Is Nothing
		Call rt.AddNewLine( 1 )
		Call rt.AppendText( cur.emp_num(0) )
		Call rt.AddTab( 2 )
		Call rt.AppendText( cur.current_asset(0) )
		Call rt.AddTab( 3 )
		Call rt.AppendText( cur.new_asset(0) )
		Call rt.AddTab( 3 )
		Call rt.AppendText( cur.new_mon_asset(0) )
		Call rt.AddTab( 2 )
		Call rt.AppendDocLink( cur, "Link to document " )  'add link to doc to the end
		
		Set cur = c.GetNextDocument( cur )
	Loop
	newDoc.Form = "Memo"
	newDoc.Subject = "IBPC Refresh DLM Update SBS"' + cur.office_num_adjusted
	Call newDoc.Save( True, True )
	Call newDoc.Send( True, "Field Technology" )

Open in new window

0
Comment
Question by:jforget1
  • 5
  • 3
  • 2
10 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757642
Call newdoc.ReplaceItemValue("SendTo", array_of_recievers)
Call newdoc.ReplaceItemValue("CopyTo", array_of_CC_recievers)
Call newdoc.ReplaceItemValue("BlindCopyTo", array_of_BCC_recievers)

Call newdoc.Send(False)

Why Send(True)?? Not good, IMHO.
0
 
LVL 22

Accepted Solution

by:
mbonaci earned 500 total points
ID: 22757655
newDoc.CopyTo = "CC Address"
newDoc.BlindCopyTo = "BCC Address"


In case of any problems try this:

newDoc.EnterCopyTo = "CC Address"
newDoc.EnterBlindCopyTo = "BCC Address"


Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757661
receiver of course... :$
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757973
Why did you accept the second (best) answer?
0
 

Author Comment

by:jforget1
ID: 22760047
Because it was the least complicated and it worked on the first try. Arrays scare me a little. :>)


Any idea on how I can get the code right to update the value of 2 fields on the record the user is on.

      Call doc.FieldSetText("status", "Reclamation Approved")
      Call doc.FieldSetText("reclamation_approved_flag", "done")
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22760395
Yep, but not in this question. Piggy-backers scare me off a little... ;-)
0
 

Author Comment

by:jforget1
ID: 22760451
I will be happy to post a new ?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 22760509
Jforget,

FieldSetText is used when the user has document opened in edit mode and is the method of NotesUIDocument, not NotesDocument.

You can replace FieldSetText with ReplaceItemValue, like this:

      Call doc.ReplaceItemValue(FieldName, NewValue)

or in your case:

      Call doc.ReplaceItemValue("status", "Reclamation Approved")
      Call doc.ReplaceItemValue("reclamation_approved_flag", "done")


Thanks for the points,
Mb¤
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22760602
LOL
0
 

Author Comment

by:jforget1
ID: 22760920
Thanks Mb.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.

820 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