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

Text File not downloaded in browser outside the vm

(0) ShareShare
ReportReport
Posted on by 59

Hi, I'm facing an issue which is the text file not be downloaded when I generate the EFT file in Vendor Payment Journal (dev and uat environment). It seems weird because it can be downloaded inside the VM's browsers but not at the outside (PC desktop browser). I tried on both Edge and Chrome. Pop up setting already allowed. Does anyone know or experience this issue? or maybe did I miss any setting to allow it? 

Thanks in advance!

I have the same question (0)
  • WillWU Profile Picture
    22,361 on at

    Hi nadiah,

    What do you mean by "the file not be downloaded".

    Could you please share your code?

    And please have a look at the old thread:community.dynamics.com/.../how-to-download-the-file-from-d365fo

    Does that solve your problem?

  • nadiah sukerman Profile Picture
    59 on at

    Hi Will, Thanks for reply. Below is the code that been written.

    const str filename = "Bank File.txt";

    TextStreamIo file = TextStreamIo::constructForWrite(); //String values appear as stringValue in generated txt

    file.outFieldDelimiter(",");

    Back to your question, what I mean by file cannot be downloaded was, I tried to generate EFT file from my desktop browsers where supposedly will appear a pop up to save the txt file as usual when we download any file in browser but the thing is there is no pop up to save the txt file after I click the button generate. It weird because it works fine when I generated from my VM (dev environment).

    Below is the screenshot when I generated from vm browser.

    pastedimage1612150615379v1.png

  • WillWU Profile Picture
    22,361 on at

    Hi nadiah,

    Did you call the FileIoPermission::assert() method to enable access to folders:

    FileIoPermission permission;
    permission = new FileIoPermission(filename, "W");
    permission.assert();

    docs.microsoft.com/.../gg839563(v=ax.60)

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Hi Nadiah,

    in your code I don't see anything that would actually offer the file for the user for download. Could you please share that part?

    Can you download any other files from D365FO? Such as data management export files?

    You could also check this blog: https://dynamics365foroperation.blogspot.com/2018/02/create-csv-file-and-save-it.html

  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    What if you copy the URL and try to open it directly? What HTTP code do you get?

    You might also be able to find this information by using developer tools in your browser (F12).

  • nadiah sukerman Profile Picture
    59 on at

    Hi All,

    Thanks a lot for the quick responds and all the helps, I had tried all the solution been given.

    After I tested on different browser (Firefox & Internet Explorer) the txt file can be downloaded as expected. It's mean our code don't have any issue is it? but when I tried on Chrome, Microsoft Edge and Opera, the file cannot be downloaded. It seems that browsers not support the code and is it possible? I feel weird btw

  • WillWU Profile Picture
    22,361 on at

    Hi Nadiah Sukerman,

    It seems that you need to change the permission setting for your FO site.

    That means there's nothing wrong with your codes. But if possible, we still hope you can provide your codes so we can check it for you.

  • nadiah sukerman Profile Picture
    59 on at

    Hi Will,

    The other thing that I found it weird is, I created a test Button on the same form using below code (onClicked event handler). By using Chrome I clicked on the test Button the txt file can be downloaded. After that I clicked on the button that got issue, the text file can be downloaded too.

    But if let say I clicked before the test Button, the txt file cannot be downloaded. It seems something need to trigger it first. Btw, the code that I'm using is similar as below, just the content is different and it quite long so I share to you the sample one.

    str filePath,

    filePathAndName,

    fileContent = "01234567890123456789";

    ;

    // prepare file name

    filePath = System.IO.Path::GetTempPath();

    filePathAndName = filePath + 'f' + guid2str(newGuid()) + '.txt';

    // Save file

    File::SendStringAsFileToUser(fileContent, filePathAndName);

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans