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

Media Field attach as Email Body or as an attachment

(1) ShareShare
ReportReport
Posted on by 7
Hi All,
I have a created a field of type media in my table and have imported an image in that. Now I want that image to be added to my email Body if possible and if not then i want that to be attached to my email attachment as a separate attachment. Please help me if this is possible in Business Central.
  • Suggested answer
    Valentin Castravet Profile Picture
    27,893 Super User 2025 Season 1 on at
    Media Field attach as Email Body or as an attachment
  • Suggested answer
    CU28101038-0 Profile Picture
    4 on at
    Media Field attach as Email Body or as an attachment
    //Below code is for making the media or image type of business central into email 
     
    tempblob : codeunit tempblob;
    logo : outstream;
    BULogo : instream;  
     
    tempblob.CreateOutStream(logo);
     
    //To export the media image to an outstream
    //evibusunit.Picture is a field of media type
    evibusunit.Picture.ExportStream(logo);
     
    //Convert it into instream for making it into email body
    tempblob.CreateInStream(BUlogo);
    emailmessage.Create(recipient, Subject, body, true);
    emailmessage.AddAttachment('Logo.png', 'PNG', BUlogo);
    email.Send(emailmessage);
     
    //Now business central image will appear into the email
     
  • Suggested answer
    Govinda Kumar Profile Picture
    2,211 Moderator on at
    Media Field attach as Email Body or as an attachment
    Hi,
    You can attach the image from your media field as an email attachment. Check out this link for code examples on sending emails with attachments.. https://businesscentralgeek.com/5-ways-to-send-an-email-in-business-central take a look at the example where a report is attached to the email.
    Hope that helps!

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,017 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans