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
0
Answers
It's used to transfer files between windows client and service tier.
Using an Azure shared directory for this works perfectly - except, I cannot write from NAV to this directory which is based on Azure storage.
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.
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!
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).
The problem here is the following: you cannot map a drive to a network location and expect a windows service to read from it - if you Google this issue you will find a lot of information about it and some kind of not officially supported workaround.
A "clearer" solution actually is to map the drive from within the service; so if we need to reach the path from NAV, we will have to map the drive from C\AL code so that the NAV service will be able to reach it.
You could use Powershell, or just issue a "net use" command from NAV to map the drive; be careful as after rebooting the service (or the server) you "may" need to map the drive again (in my experience peersistent is useless for this scenario).
Bad (but working) Code Example:
Bye!
What variable type is Process?
Jordi