Pages

Monday, October 10, 2016

Upload blob data in AX. BinData class.

I would like to present you very user full class which is avaiable in 4, 2009 and 2012 versions of AX.

Everytime you have to work with blob type data in just few lines you can load and save fille in AX in container type field. Works on client and server side.

Below you can see example of how to load file to container and back, form container to file:

    BinData             binary;
    FilePath            filePath;
    FileIoPermission    perm;
    container           con;
    ;

    filePath = @"c:\temp\from.jpg";
    binary = new BinData();
    perm = new FileIoPermission(filePath, 'rw');
    perm.assert();
    binary.loadFile(filePath);
    con = binary.getData();
      
    binary.setData(con);
    binary.saveFile(@"c:\temp\to.jpg");


Please check MSDN to see more sources where from you can read and save data to.

No comments:

Post a Comment