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, ...
Suggested answer

Export Image from a Table field to a local directory

(1) ShareShare
ReportReport
Posted on by 89
Hi,
 
I want to export the image saved in a table for example CompanyImage and I want to export the Image from Companyimage to a local directory on my system. I followed the following link: https://eprogrammers.blogspot.com/2016/07/how-to-export-import-images-or-pictures.html
 
Kindly see the code below that I wrote.
 
 
I am getting an error in AifUtil::saveBase64ToFile(@filepath, content) that this method does not exist in this class. It is true that this method does not exist in this class but every guide article mentions only this way to export images. The other way I tried is as follows:
 
 
It is also not working as no file is saving in the directory. Any quick solutions by the community are appreciated. Thanks!
I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    296,568 Super User 2025 Season 2 on at
    Export Image from a Table field to a local directory
    Hi Sadia,
     
    You can use the next coding for retrieving the file into a stream and send it to the user for download.
     
    public void downloadImage()
    {
        System.IO.Stream stream = null;
        container        fileContainer = myTable.Image;
    
        if (fileContainer && conLen(fileContainer > 0)
        {
            Binary binaryData = Binary::constructFromContainer(fileContainer);
            if (binaryData)
            {
                stream = binaryData.getMemoryStream();
            }
    
            File::SendFileToUser(stream, 'image.tiff');
        }
    }
     
  • SA-20091232-0 Profile Picture
    89 on at
    Export Image from a Table field to a local directory
    Hi Andre,
    The image stored in the table in D365Fo is already in .tiff format in a container-type field. I just want to export it through code, like we export any table data of D365FO in an Excel sheet through code i.e. Like this https://community.dynamics.com/forums/thread/details/?threadid=60d59b32-171a-451a-b297-111fb4caf732. But the difference is that I want to export only image from the table and in image format instead of excel or CSV. In short, I want to download the image from the table through code. So Let's forget for once to export it to either local storage or any other cloud platform. can we download the image from the D365Fo table?
  • André Arnaud de Calavon Profile Picture
    296,568 Super User 2025 Season 2 on at
    Export Image from a Table field to a local directory
    Hi Sadia,
     
    Is the image you have in your environment already in a tiff format? As mentioned in my previous reply, the Dynamics 365 application can't access your local storage. You would then need to use middleware that can retrieve the exported image from a cloud storage or stream and move it to your local drive.
  • SA-20091232-0 Profile Picture
    89 on at
    Export Image from a Table field to a local directory
    Hi Andre,
     
    I'm using D365FO and I want to export the image in .tiff format on my local directory. How can I achieve that through data entities? As far as I know, data entities cannot export data in image format. Can you advise any solution based on the export of images from a table field on the local directory? 
  • André Arnaud de Calavon Profile Picture
    296,568 Super User 2025 Season 2 on at
    Export Image from a Table field to a local directory
    Hi Sadia,
     
    Are you using Dynamics AX 2012 or Dynamics 365 F&O? The method doesn't exist in Dynamics 365 as that became a cloud solution which is not aware of your local device.
    In Dynamics 365, you can use Data Entities and export via Data Management, or create a stream giving the option to the user to download a file.

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

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans