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

Announcements

No record found.

News and Announcements icon
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

  • 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,887 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Hannes Holst Profile Picture

Hannes Holst 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans