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

Send email with report attached as PDF with x++ in D365FO

(3) ShareShare
ReportReport
Posted on by 598

I’m sending an SSRS report by email from X++ using SrsReportRunController. The email sends fine and the attachment is created, but it always arrives as CSV even though I explicitly set the format to PDF.

SrsReportRunController controller = new SrsReportRunController();
controller.parmReportName(ssrsReportStr(BackStockReport, Report));
controller.parmShowDialog(false);
controller.parmLoadFromSysLastValue(false);

SRSPrintDestinationSettings settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::Email); // I've tried also File here
settings.fileFormat(SRSReportFileFormat::PDF); // Here
settings.fileName("Report attached");

I’ve already tried disabling dialogs and adjusting print destination settings, but nothing changes the output format.

I have the same question (0)
  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    I think that the file format gets changed later by some other code. The debugger should tell you more.
     
    Or are you able to give us full code demonstrating the problem on a standard report, so we can test your code?
  • Verified answer
    Komi Siabi Profile Picture
    13,208 Most Valuable Professional on at
    Hello, 
     
    You need to explicitly define the attachment file format in your SrsReportEMailDataContract.
     
    SrsReportEMailDataContract  emailContract;
    emailContract = new SrsReportEMailDataContract();
    emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);
     
     

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans