0

I am trying to get the folder path of a file (e.g. "C:\folder\file.exe") in Dynamics NAV/CAL. It is trivial to do by using the standard Microsoft Codeunit 419 - File Management, as OpenFolderDialog does exactly that.

Unfortunately this uses DotNet which does not work in the Webclient (specifically System.Windows.Forms.OpenFileDialog). Any ideas how that functionality can be implemented in a way that works in the Webclient (preferably without a Javascript Addin, but if there is nothing else, I would consider that, too.)

2 Answers 2

2

You can't use the Folder Browse Dialog on the Web Client. You'll need to redesign your solution around this limitation (of web browsers, not necessarily NAV).

You can only upload files using the standard UPLOAD function, or using a Javascript Add-in with a HTML File Browse form.

If you're trying to get just the folder path of the C:\folder\file.exe you would use

DirectoryName := FileMgt.GetDirectoryName(Filename) 
2
  • Yeah, that is what I feared. GetDirectoryName unfortunately doesn't work for me, because I want the user to select the file via a dialog. Thanks for the answer. Commented Jul 28, 2017 at 7:19
  • There's just no concept of folders on the web. Files and that's it! Commented Jul 28, 2017 at 7:21
0

Shouldn't Upload function automatically rise dialog box even on web client?

2
  • Upload raises a dialog, but I can only upload the file to the database there, not get the original folder path. Commented Jul 28, 2017 at 7:14
  • 1. Not to the database, but to the folder on server running Nav Server service. 2. Information about path on client computer running web client is ultimately useless. You can't have access to it anyway. Or if you can it it a flaw in your design.
    – Mak Sim
    Commented Jul 28, 2017 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.