web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    RE: How to generate a file using TextIO class on the server

    Hi!

    Menu Item also has RunOn property 

  • Community Member Profile Picture
    on at
    RE: How to generate a file using TextIO class on the server

    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
    236,297 Most Valuable Professional on at
    RE: How to generate a file using TextIO class on the server

    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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans