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 :
Microsoft Dynamics AX (Archived)

How to generate a file using TextIO class on the server

(0) ShareShare
ReportReport
Posted on by

Hi everybody,

I have a problem generating a file with the textIO class from the server, that is the code:

filename =  custFormletterParameters.DocumentAutoindexPathINL + strFmt("%1_%2.csv", @"\ATECNA", strDate);
file = new TextIo(filename, #IO_APPEND);
perm = new FileIoPermission(filename, "W");
perm.assert();

That is a part of a class wthat is going to be runned on bacth. To test the class y set the "RunOn" property to "Server" (if I use "Called from" it works fine). When I launch the class using an action menuItem, the file variable gets NULL value... Does anybody knows how can I generate a file from the server?

Thanks everybody.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi!

    Menu Item also has RunOn property 

  • Community Member Profile Picture
    on at

    The permission should be given prior to the new TextIo command

    filename =  custFormletterParameters.DocumentAutoindexPathINL + strFmt("%1_%2.csv", @"\ATECNA", strDate);

    perm = new FileIoPermission(filename, "W");

    perm.assert();

    file = new TextIo(filename, #IO_APPEND);

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

    Is the file accessible from server? And does the AOS service account permissions to write into it?

    If you run the same code from a different computer (client instead of server) and as a different user, you obviously can get different results.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans