Get the folder path of a file in Dynamics NAV without using FileManagement.OpenFolderDialog
holgerbaehren
Member Posts: 4
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.)
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.)
0
Best Answer
-
It's not supported.
But as the path needs to be UNC, if to be handled by NAS, then good luck with learning the users that.
Think you need JavaScript for this.
Instead:
I would make a inbound folder and let the user choose the file from there. The service tier can list files in this folder via temp table. This folder could be a network drive. NAS could move or delete the file when handled.
Also check out how MS does in WebClient with Incoming Documents, maybe something there can be used.Follow me on my blog juhl.blog5
Answers
-
If you only need to get 'C:\folder', you can use this:
Path(Filename : Text[1024]) Path : Text[1024] Filename := DELCHR(Filename,'<'); Path := Filename; WHILE STRPOS(Filename,'\')<>0 DO BEGIN Filename := COPYSTR(Filename, STRPOS(Filename,'\')+1); END; IF STRLEN(Path) > STRLEN(Filename) THEN EXIT(COPYSTR(Path,1,STRLEN(Path)-STRLEN(Filename))) ELSE EXIT('');0 -
I probably didn't state the original question clear enough. I want the customer to select the file via an open file dialog and then write the path of the file into the database. Not a problem with OpenFolderDialog, but that does not work on the web client.0
-
It's not supported.
But as the path needs to be UNC, if to be handled by NAS, then good luck with learning the users that.
Think you need JavaScript for this.
Instead:
I would make a inbound folder and let the user choose the file from there. The service tier can list files in this folder via temp table. This folder could be a network drive. NAS could move or delete the file when handled.
Also check out how MS does in WebClient with Incoming Documents, maybe something there can be used.Follow me on my blog juhl.blog5 -
Then you can use something like that
IF FileMgt.CanRunDotNetOnClient THEN FileName := FileMgt.OpenFileDialog('Choose file:', '','CSV files (*.csv)|*.csv|All files (*.*)|*.*') ELSE FileName := FileMgt.UploadFile('Choose file:', FileName);0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
