web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)
Suggested Answer

Error AddAttachment file on NAV2015

(0) ShareShare
ReportReport
Posted on by 15

Hi,

I have a Dynamics Nav 2015 installed on a domain server. When I try sending a quote (or any other attachment for that matter) via email, it gives me an error on the AddAttachment function.

Microsoft Dynamics NAV
---------------------------

Attachment C:\ProgramData\Microsoft\Microsoft Dynamics NAV\80\Server\MicrosoftDynamicsNavServer$DynamicsNAV80M\users\default\TALIDA\EDMHILAL\TEMP\__TEMP__d14eb1d1b6254de3993bd2792f8a9495.tmp.pdf does not exist or can not be accessed from the program.
---------------------------
OK
---------------------------

The error is showing on this path location and on any another path on the server. although I have gave already a full permission on all the folders.

SMTP is setup correctly and used the test mail feature which was successful.

what do you think about this error?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    I think your file name has problem as it contains .tmp.pdf . This might me problem

  • Suggested answer
    Maneesha Profile Picture
    5,891 on at

    Ahmad Barbar ,

    i don't think this is the location that your file exactly stored right ?

    have you test mail with attachment ?

  • Suggested answer
    Binesh Profile Picture
    7,885 on at

    Hello Ahmad,

    Before attachment write some more line, see bellow code

    // Here FileNameWithPath and ToFille is a text variable, And FileMgt is a codeunit 419.

    //Now in ToFile upload your file as you doing, or see bellow.

    ToFile := FileMgt.UploadFileSilent('C:\TEMP\RUWMSP.pdf');

    //Now you have to download file from temp path

    FileNameWithPath := FileMgt.DownloadTempFile(ToFile); 

    // Finally pass the Variable FileNameWithPath in your AddAttachment function.  :)

  • ManishS Profile Picture
    86 on at

    You should check standard code for addattachment, there is change in the function, now it requires two parameter.

  • ahmadbarbar Profile Picture
    15 on at

    The file name has generated automatically from NAV and you can open it.

  • ahmadbarbar Profile Picture
    15 on at

    The location is correct dear.

  • ahmadbarbar Profile Picture
    15 on at

    Hello Binesh,

    This is my code Dear,

    ServerAttachmentFilePath := '';

       ServerAttachmentFilePath := FileManagement.ServerTempFileName('pdf');

       SalesStatisticReport.SAVEASPDF(ServerAttachmentFilePath);

       CLEAR(SalesStatisticReport);

       IF NOT EXISTS(ServerAttachmentFilePath) THEN

         ERROR(ServerSaveAsPdfFailedErr);

       SMTPMail.AddAttachment(ServerAttachmentFilePath, 'Salesstatistic.PDF');

       SMTPMail.Send;

    The saving function is working correctly and my error is on Addattachment function.

  • ahmadbarbar Profile Picture
    15 on at

    The idea is that my code is working correctly on my local database NAV2016 but on the client server NAV2015 has showing the error.

  • ManishS Profile Picture
    86 on at

    you need to download the pdf on client machine.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans