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)

Server side how create file to client

(0) ShareShare
ReportReport
Posted on by 642

Helloo everybody,

I have a process running on server side and I would like create a file and save it in a local path.

What is the best way to ddo it ?

Thank you

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    The usual way is using a network path accessible by both the server and clients. Note that you can map a network location as a drive in Windows.

  • DONA Profile Picture
    642 on at

    I know :-) but here it's a particular case

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

    The server can't access client local path directly, only through the network (you could, in theory, create a shared folder on client and let AOS know about it).

    If you want to save a file directly from code to client local path, you can't do it from AOS. You would have to send the data from sever code to client code and let the client to save it to a local file.

  • DONA Profile Picture
    642 on at

    Ok but its' not possible using copyFileToClient_Client of SysFileStoreManager class ?

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

    Yes, that's what I was talking about the second paragraph - copying the data from server to client and using code on client to store the data to a file.

  • DONA Profile Picture
    642 on at

    In my case I have to generate a file to client side automatically when I am posting a sales order invoice.

    It's possible to do that in one step ? During posting ?

  • Verified answer
    Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    When posting interactively, you could use the approach with copying to client, but it's not possible with batch postings.

    I strongly recommend you use the same approach for both; i.e. a network folder. You can map it as a local drive, let's say H:, and simply tell them to look for files on H:\... instead of C:\....

  • DONA Profile Picture
    642 on at

    Another question Martin, I have an issue when I lunch in CIL.

    1.I create my file on server side ok

    2.I want to load my file  binData.loadFile(filenameServer), it deos not work : "Unable to load file"

    In Xpp it runs !

    Have an idea

    Thank you

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

    First make sure you've generated CIL.

    Then please give us more information. What's your code, how did you run in in X++ on server (I want to be sure it was really on server) and in CIL?

  • DONA Profile Picture
    642 on at

    Yes Full CIL is generated.

    The file is generated by Class SalesInvoicePost in endPost method

    The file is created on C:\temp on server (ok), then I want to copy it to client side:

    MyCode :

    SysFileStoreManager::copyFileToClient_Client(MyGetPackedFileServer(fileNameServer),fileNameClient);

    static server container MyGetPackedFileServer(Filename _fileName)

    {

       #FILE

       BinData             binData = new BinData();

       new FileIOPermission(_fileName, #io_read).assert();

       binData.loadFile(_fileName); // in CIL I have the issue Unable to load file

       return binData.getData();

    }

    Thanks

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