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
    Valentin Castravet 26,349 Super User 2025 Season 1 on at
    Media Field attach as Email Body or as an attachment
  • Suggested answer
    CU28101038-0 Profile Picture
    CU28101038-0 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
    Govinda Kumar 2,209 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February 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... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans