web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Open a local file with X++

(1) ShareShare
ReportReport
Posted on by 454
Hello, I want to open a local file in my C:\ drive when clicking a button in D365FO.
 
I'm in tier-1 environment
 
I tried to use browser.navigate function to open in a browser but it didn't work, it was giving pop up errors.
 
Even I tried to access the file directly to open it, and also it didn't work.
 
Seems like the D365FO can't read my local C:\ drive.
 
Can someone help.
 
 
I have the same question (0)
  • Martin Dráb Profile Picture
    235,979 Most Valuable Professional on at
    Open a local file with X++
    Could clarify the solution, please? In my opinion, none of the verified answers is about what you wanted.
  • CU09091357-0 Profile Picture
    454 on at
    Open a local file with X++
    I verified the answers
  • CU09091357-0 Profile Picture
    454 on at
    Open a local file with X++
    @CU09091357-0 okay thanks
  • Verified answer
    Anthony Blake Profile Picture
    2,623 Super User 2025 Season 2 on at
    Open a local file with X++
     
    Are you fixing the file name and location, because if its interactive anyway (click of a button) you could use the file upload control or the file upload dialog File::GetFileFromUser()
     
     
    Thanks
    Anthony
  • CU09091357-0 Profile Picture
    454 on at
    Open a local file with X++
    Martin Dráb will try this approach, thank you!
  • Martin Dráb Profile Picture
    235,979 Most Valuable Professional on at
    Open a local file with X++
    First of all, your URL is wrong. You can't use the local path (C:\Attachments\file.pdf) as a URL; you must use the file URI scheme instead (e.g. file:///c:/Attachments/file.pdf). Please test the URL before continuing.
     
    But as I remember, such URLs don't work in Browser.navigate(). You'll need to look for a different solution. What about storing the files directly in the database (and avoid both this topic about local files and your problems with the Azure storage emulator)?
  • CU09091357-0 Profile Picture
    454 on at
    Open a local file with X++
    Martin Dráb I'm in my local environment, I'm using it as data archive.
    The attachments are not accessible because we don't have their metadata in the local emulator (127.0.0.1:10000), and we tried everything but nothing is working.
    I have all the attachments downloaded in my C:\ drive.
    I'm using the approach of opening a new tab with url: C:\attachments\filename (which is the fileid that I will take from the docuvalue table when I click the button that I created and wants to write the code that opens me a new tab inside), so the file open.
  • CU09091357-0 Profile Picture
    454 on at
    Open a local file with X++
    Mohamed Amine Mahmoudi okay man, thanks for your clarification!
  • Martin Dráb Profile Picture
    235,979 Most Valuable Professional on at
    Open a local file with X++
    Please give us more details than just repeating that you want to open a file.
     
    Do you mean that you assume that every user's computer has C:\Attachments\file.pdf (which sounds like a strange assumption to me) and you want to open the file by the web browser or a default application for PDF files? If so, we should ignore the remark "the D365FO can't read my local C:\ drive", because the requirement is not about reading any files in F&O, right?
  • Verified answer
    Mohamed Amine Mahmoudi Profile Picture
    26,294 Super User 2025 Season 2 on at
    Open a local file with X++
     
    As far as i know, you can't access files on a local machine since D365fo is a web application. in this case, so i suggest you use power automate to retrieve your files through a connector (on-premises data getway).
     
    Best regards,
    Mohamed Amine MAHMOUDI

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 844 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 752 Super User 2025 Season 2

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 553

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans