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

How to write export data in Excel with RunBase

(0) ShareShare
ReportReport
Posted on by 972

Hi All

I am going to write a function to export filtered data into excel in D365FO. I know how to write function for exporting data to excel. However, when I add this function into RunBase class, it always got error at "file::SendFileToUser(memoryStream,"Test.xlsx");". Does anyone have idea about how to write export data in Excel with RunBase?

pastedimage1654204133965v1.pngpastedimage1654204167192v2.png

I have the same question (0)
  • JustZM Profile Picture
    972 on at

    Hi All

    Sorry, please let me correct information for above.

    when I debug, it can successfully pass "file::SendFileToUser(memoryStream,"Test.xlsx");". However, in the final, file is not downloaded, and get error "An internal error has occurred. Please contact your system administrator."

    Best Regards,

    Jack

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Aren't you running it in a batch? Trying to use SendFileToUser() in batch is logically wrong, because there is no user's browser to send the file to. The process is executed on a batch server, not by a user.

    You need to save the file somewhere where users can download it from later, or activelly send it to users in some way. For example, you can save attach the file to a record in F&O, send it by e-mail, store it in Azure storage and so on.

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 616

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans