Hi.
I'm currently trying to browse a network drive to attach some files to a mail.
Currently I'm using the DotNet System.Object and System.IO.Directory and System.Collections.Generic.List to find the filepaths in the following way:
SysObj := SysDir.GetFiles(DirectoryPath);
SysList := SysList.List;
SysList.AddRange(SysObj);
FOR j:= 1 TO SysList.Count DO BEGIN
CurrentFile := FORMAT(SysList.Item(j-1));
END;
Since only the NAV clients have access to the network drives in which the files exist, RunOnClient has to be set to true for these DotNet data type variables.
I want to move these files to a drive on the same server the NAV server runs on, but I can't simply use System.IO.Directory.Move(file1,file2), since the client won't have access to the server's drives.
Is there any smart way of going about this, since I can't set the File datatype to RunOnClient = true?
Thank you in advance.
0
Answers
What version of NAV are you running?
If you run a newer version of NAV or BC, then you can use Codeunit 419 File Management.
There is a function called UploadFileSilentToServerPath, where you can pass your client path and your server path.
This will upload the file.
The CU 419 is the holy bible for file handling
Talent Business Solutions
Technical Expert of Microsoft Dynamics 365 Business Central
Website | Mail | LinkedIn
@SanderDk Thanks for the response, I'm currently on 6.02, with no File Management CU unfortunately, but I'll grab the function code from a newer version, and try using it in the 6.02, since it only requires dotnet objects and not data types such as blobs.
Talent Business Solutions
Technical Expert of Microsoft Dynamics 365 Business Central
Website | Mail | LinkedIn