Solved

Trouble transferring attachment

Posted on 2010-08-31
2
217 Views
Last Modified: 2013-12-18
THis is a follow up to a question from last week for me. I have tried to get the code below working to take the attached doc in the "doc" field on a record and copy this over to a tracer email which is sent to the user. I have tried many edits on this one but cannot get the attachment to come over to the letter. It is probably some simple little edit needed, but if anyone sees what I am missing here it would be greatly appreciated. The field on the main doc that has the attachment is called doc and the fieldname on the letter that goes to the user is called doc_attached.  
Sub Initialize
	Dim ws As New notesuiworkspace
	Dim session As New NotesSession 
	
	Set db = session.CurrentDatabase
	Set uidoc=ws.currentdocument
	Set doc=uidoc.document
	extractpath = "c:\temp\"
	On Error Resume Next
	Set emaildoc = db.CreateDocument
	
	
	emaildoc.Form = "exp_mgt_final_copy"
	emaildoc.SendTo = doc.contact
	emaildoc.Principal = "IDSalesMaterialSubmission"
	emaildoc.Subject ="Submission # " + doc.sub_num(0) +" Approved - Please return Final product "
	
	Set rtitema = doc.GetFirstItem( "doc" ) ' or specify whichever RTField you need.
	If Not ( Isempty( rtitema.EmbeddedObjects) ) Then
		
		Forall o In rtitema.EmbeddedObjects
			If ( o.Type = EMBED_ATTACHMENT ) Then
                  ' extract file attachment to temp area
				Call o.ExtractFile( extractpath & o.source )
                  ' embed in other doc
				Set object = rtitemb.EmbedObject( EMBED_ATTACHMENT, "", extractpath & o.source)      
				Set rtitemb = New NotesRichTextItem(emaildoc, "doc_attached")
			End If
		End Forall
	End If		
	emaildoc.ld_num = doc.ld_num
	Call emaildoc.Send(True)
'	doc.status = "Final Copy Required" 
	Call doc.Save(True,True)
End Sub

Open in new window

0
Comment
Question by:jforget1
[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
2 Comments
 
LVL 10

Accepted Solution

by:
doninja earned 500 total points
ID: 33567912
Reading the code are you embedding the object inb line 26 before you have the richtext field defined in line 27 ?

Try swapping those two around so you have a field to embed into.
0
 

Author Comment

by:jforget1
ID: 33567947
Wow I thought it was close but had no idea it was that close. Swapped those 2 lines and it attached perfectly. Thanks for the help.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

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…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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