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 :
Microsoft Dynamics AX (Archived)

Open files from Ax

(0) ShareShare
ReportReport
Posted on by 107

Hi,

We have a requirement where we want to open files directly from in Ax. The files we want to open have different file types (PDF, PNG, ...).

I found and used the following command to open files:

WinAPI::shellExecute(_fileName,'','',#ShellExeOpen);

This command seems to work fine for certain files (like PDF) but it doesn't work for other types (like PNG for example).

When i open the file directly from windows, the PNG file opens in Paint. But when i open it with the command stated above, i get the error:

"The file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel."

I don't understand this message, since the type PNG is already linked to a default program and it opens fine when i do it in windows file explorer.

Can i somehow do the same from in Ax?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Open files from Ax

    It is fully supported to use the .Net namespace in AX, you may call it in a similar way to this C# example:

    stackoverflow.com/.../open-file-with-associated-application

    You have to make sure that there is an associated default program indeed for the file extension, because some file types might be handled by the Windows kernel itself.

  • BuBbA Profile Picture
    107 on at
    RE: Open files from Ax

    I tried using it that way, but the same result: PDF files are being opened but PNG files do nothing. I am not getting any errors or anything, it just doesn't do anything.

    Edit: I forgot catching the CLR error. Now i get the same error as i do when using WinApi::ShellExecute. No application is associated with the specified file for this operation. But as i said before, the default for PNG has been set so i don't understand the error.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Open files from Ax

    Then you do not have PNG files associated indeed, like the error message says.

    By default, Windows kernel opens it within Internet Explorer, but that is most likely not a traditional default file extension match.

    Try installing a picture viewer custom software that supports file extension association based on the registry, then attempt calling the process start.

  • Tolstov Dmitrii Profile Picture
    5 on at
    RE: Open files from Ax

    Try to use this command for png file :

    WinAPI::shellExecute(_fileName,'','','');

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans