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 :
Finance | Project Operations, Human Resources, ...
Answered

UPLOADING ANY TYPE OF FILE AS ATTACHMENT IN EMAIL AND SEND THROUGH X++

(0) ShareShare
ReportReport
Posted on by

I want to send any type of file such as excel, text , etc in attachment when sending mail through x++ ,which i will upload in the dialog box using edt "FILENAMEOPEN"...

That means i will upload my file in dialog box , and want to send that attachment through email in x++ 

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    238,753 Most Valuable Professional on at

    All right, and which part do you need our help with?

    A trivial implementation could be something like this:

    FileUploadResultBase result = File::GetFileFromUser();
    if (result.getUploadStatus())
    {
        SysMailerMessageBuilder builder = new SysMailerMessageBuilder();
        builder.addTo(...);
        builder.addAttachment(result.openResult(), result.getFileName());
    
        SysMailerFactory::sendInteractive(builder.getMessage());
    }

  • Community Member Profile Picture
    on at

    hello Martin,

                      I am getting this error when i am selecting the file to upload

                      "The FileUpload Strategy Class you selected does not exist"??

    As well as the code is below -:

    dialogfieldfile = dialog.addField(extendedTypeStr(FilenameOpen),"File Selector");

    FileUploadResultBase result = File::GetFileFromUser();

              if (result.getUploadStatus())

              {

               builder.addTo(getvalue);

               builder.setFrom(sysEmailParameters.SMTPUserName);

               builder.addCc(cc);

               builder.addAttachment(result.openResult(), result.getFileName());

              }

  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    probably you would want to have a look at new way of uploading files. as the same app is used in cloud now, as well for on-prem, therefore legacy code cannot be used as in old days. please have a look at next discussion.

    community.dynamics.com/.../812848

  • WillWU Profile Picture
    22,363 on at

    Hi UDIT,

    Please change

    FileUploadResultBase result = File::GetFileFromUser();

    to

    FileUploadTemporaryStorageResult result =  File::GetFileFromUser() as FileUploadTemporaryStorageResult;

  • Community Member Profile Picture
    on at

    6012.Capture.PNG

  • Community Member Profile Picture
    on at

    I am having this requirement , on dialog i have 3 fields in which on one filed i need to upload the file and send it as attachment

  • Community Member Profile Picture
    on at

    hi will.

            how will it get my uploaded file , which i have uploaded in dialog field of mine ??

  • WillWU Profile Picture
    22,363 on at

    Hi Udit,

    This framework dose the job and stores your file to the temporary blob storage.

  • Community Member Profile Picture
    on at

    Not its not working still same error,..

  • WillWU Profile Picture
    22,363 on at

    Hi Udit,

    Sorry I gave you the wrong code,i have edited it, please try it again.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 509 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 375

#3
Adis Profile Picture

Adis 268 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans