I would like to export pictures from Microsoft Dynamics NAV 2009.
I try to export with the following script :
declare @path varchar(100)= 'C:\Pictures\'
,@path+[MyID] AS Path
Files are correctly created with a size which seems to be correct, but the image seems to be crypted, regarding the structure of the file , it is not a jpg, bmp ....
The structure of the files begins like this :
Thank you in advance for you help
I know that does not solve the problem but I'll give you some links and examples
If you are using NAV BLOB Fields; by default the Compressed property is <Yes>, which means the value is zipped and not usable externally; Change this property to No and the value will be the binary of a normal bitmap format (provided that is whats stored there) which you can extract and display externally.
Some samples & links
NAV export samples:
// export blobs as bmp files
IF Picture.HASVALUE THEN BEGIN
PictureFileName := FormatFileName(FilePath,Item."No.");
IF item.Picture.HASVALUE THEN
DOWNLOADINTOSTREAM(InStrm, 'Save image', 'E:\', '*.bmp', '');
Form 346 ...
IF Picture.HASVALUE THEN
Use Encode\Decode 64 functions to convert a BLOB to Base64
ex: Codeunit 99008516 - BizTalk XML DOM Management
Function 'GetPicture' converts a Base64 encoded DOM node to binary and imports it into a BLOB.
Function 'AddPicture' converts a BLOB to Base64 encoding and adds it to an XML doc...
You can use Encode\Decode 64 functions on sql server stored procedures, views, sql scripts
Basically, a BLOB field in NAV contains a byte-array, so the challenge is how to read or write this byte-array and use it in the conversion methods. In .Net we can use Stream objects to work with byte-arrays.
.NET Base64 encoding\decoding
To convert a Base64 string to binary data, we can use the "Convert.FromBase64String" method. It accepts a string as input parameter and returns a converted byte-array.
To convert binary data to a Base64 string, we can use the "Convert.ToBase64String" method. It accepts a byte-array and returns a Base64 encoded string.
To exchange binary data in a web service, it is common use to convert the binary data to Base64 encoding. The .Net Framework has built-in support for Base64 converting with the System.Convert class.
Good link this:
How to import and export BLOB fields using Dataports in Navision
My Blog http://rsdynamicsnavblog.wordpress.com
Thank you for your help
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics