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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

importing base64string (api call) as contact image.

(0) ShareShare
ReportReport
Posted on by 10

Hello all,

I'm stuck with importing a image to a contact in BC by using an API call.

I made a codeunit that I can as a webservice.

In this codeunit I use a bigtext parameter that holds the base64string of the image.

When i'm trying to preform my call I get the following error:

   "message""The media object could not be loaded because it is not a valid image type, such as JPEG, GIF, or PNG. 
pastedimage1647440364046v2.png
I make an outstream of the bigtext that holds the base64 string. I put this in a blob so I can get it as an instream and add it to the media type:
var
        instream: InStream;
        outstream: OutStream;
        tmpblob: Codeunit "Temp Blob";
        Base64: Codeunit "Base64 Convert";
...
        tmpblob.CreateOutStream(outstream);
        photo.Write(outstream);
        tmpblob.CreateInStream(instream);
        lContact.image.ImportStream(instream, lContact."No." + '.jpg', 'image/png');
Does anyone know what I'm doing wrong?
If I add the mime type 'image/png' it makes the record put it shows the following as image:
"Geen voorbeeld beschikbaar voor type media-inhoud application/octet-stream"
translated : "No preview available for media type application/octet-stream"
pastedimage1647440430832v4.png
Kind regards
Tim
I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

  • TimXams Profile Picture
    10 on at

    Hi Marco,

    Thank you for you answer.

    I tried getting access to the yammer community. But I have to wait for approval.

    It is taking a long time to get approved apparently.

    Do you know anyone who I can contact, to get access this community?

    This is the respons I get if I try to access the community:

    pastedimage1649077238008v1.png

    Kind regards,

    Tim

  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    That is new for me. Let me ask around if there is a specific approval process in place and what the requirements are to get into that group.

    Thanks.

  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    I did ask around and this link may be helpfull:

    docs.microsoft.com/.../devenv-checklist-submission-faq

    You can send mail to a mail address if there are issues.

    The people performing approval are most likely at the launch event in Orlando.

    Thanks.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans