Writing from NAV to Azure Storage

CraigSCraigS Posts: 4Member
I have an NAV implementation which is running on an Azure VM. I am writing out files to the server which are then ftp'd to a 3rd party warehouse.

I need users to be able to view and move these files from their local machines. So basically I need a file share which is accessible from both the server and the client pc.

The server and the client pc's are not on a shared domain. I thought I had a reasonably elegant solution in that I could create a file share using an Azure storage account. A "net use" function allows me to create a share on the server and also on the users pc's. This works very well and users can see directories and files in this share.

However, NAV does not seem to be able to write out to this directory. When I call MyFile.CREATE(.....) I simply get a "Could not find a part of the path 'F:\Warehouse\Outbound\SORD_SO00412.xml'." if I map the drive, or "I/O Error" if I use a UNC path.

I appreciate that this is likely due to the fact that this is not a "normal" windows directory. Has anyone manged to write to such a directory and have sample code they could share?

Thanks
Craig

Answers

  • JuhlJuhl Posts: 195Member
    Magicpath is your friend. See File Management CU, think it's 419, can't remember.
    It's used to transfer files between windows client and service tier.
    Follow me on my blog juhl.blog
  • CraigSCraigS Posts: 4Member
    edited 2017-05-18
    Thanks Juhl. Unfortunately I don't think that is the answer. The issue I have is not writing from server to client or vice versa. I want the files to be written to a directory on the NAV server which is where the ftp process will pick them up and move them off site. I want users to be able to access that directory via a share in case they need to move files from an error directory to a processing directory. Doing this via a network share is preferable to them having to log onto the NAV server to do it.

    Using an Azure shared directory for this works perfectly - except, I cannot write from NAV to this directory which is based on Azure storage.
  • JuhlJuhl Posts: 195Member
    All fileaccess happens on the server, so what ever you program for the clients to use, will point at the server.
    Make a page fill it with file-list and make actions to move or whatever using .Net.

    Think you are overthinking/looking how easy this could be.

    I always stream files from memory direct to ftp, without touching the file system.
    Follow me on my blog juhl.blog
  • EvREvR Posts: 165Member
    You could easily upload the files to azure blob storage using the .net api provided by Microsoft, and save the url to the nav record instead of the UNC path. That's what I've been doing for years and it hasn't failed me yet.
  • JuhlJuhl Posts: 195Member
    edited 2017-05-19
    EvR is right.
    But all this is crossing the river to get water.
    Create the data in memory using streamwriter. Send the stream to ftp instead of saving to file first.
    All this can be done with standard .Net.
    No need for ever using the file system to send a file to ftp server!
    Follow me on my blog juhl.blog
  • EvREvR Posts: 165Member
    edited 2017-05-22
    I think the world has moved on from FTP :)
    The great thing about Azure blob storage is that it's dirt-cheap and requires no maintenance and backups.
    Using the azure api won't require you to save it to a file either. Just transfer a byte[] directly (or base64 encode it from memory).
  • pradipradi Posts: 8Member
    HI @craig.s did you find a solution to write a file in Azure storage directory. I too need to write a file and facing the same issue.
Sign In or Register to comment.