Hi,
I've created a process to automatically send an e-mail to each customer ship-to. The e-mail also has a report that I've created using the SAVEASPDF function so the report can be sent as an attachment.
I can send the e-mail without problems, but I can't attach the pdf file. The code I have written so far is:
ToFile := DELCHR(ShiptoAddress."Customer No." + FORMAT(WORKDATE),'=','/\:.,') + '.pdf';
FileName := TEMPORARYPATH + ToFile;
REPORT.SAVEASPDF(REPORT::"My Report",FileName,ShiptoAddress);
ToFile := ReportHelper.DownloadToClientFileName(FileName, ToFile);
<The code to write the send to, body, etc>
Mail.AddAttachment(ToFile);
Mail.Send();
The ReportHelper codeunit is from Claus' blog found here:
http://blogs.msdn.com/b/nav-reporting/a ... -2009.aspx
I checked codeunit 397 (Mail) that the blog is using. It seems to convert the link to the file with this code in the codeunit:
IF AttachFileName <> '' THEN BEGIN
BSTRConverterAttachFileName.ResetBSTR;
BSTRConverterAttachFileName.AppendNextStringPortion(AttachFileName);
OAttachments := OSendMail.Attachments;
OAttachment := OAttachments.Add(BSTRConverterAttachFileName);
END;
Does anyone know how I can add the attachment using SAVEASPDF using the SMTP Mail (codeunit 400) codeunit?
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
So do you mean:
Something like that?
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Any suggestions?
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
For a Dynamics NAV MVP, you're pretty smart!
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n