Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

BLOB in Email Body

Posted on by Microsoft Employee

Hi All,

I'm trying to do a customization about whenever user created a notes and ticked the Notify, then system will send the notes to the Notify User thru email.

Found that Note is actually a BLOB file type and wondering how can i convert this file type to a text format, or is there any other ways i can making this BLOB data show in the email body. I'm using the codeunit 400 SMTP Mail to creating email and send.

Many thanks in advanced for any help.

Regards,

TC

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: BLOB in Email Body

    Hi Guys,

    I do found another useful links for converting BLOB into Text, hopefully this can help whoever in need.

    nav-magno.be/.../reading-notes-through-code

    Regards,

    TC

  • 4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: BLOB in Email Body

    You're welcome! Cheers!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: BLOB in Email Body

    Hi 4Bz Software,

    Many thanks for your help!

    I believe this piece of code could help me on putting the notes into mail body.

    Regards,

    TC

  • Verified answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: BLOB in Email Body

    Hi Travis,

    Below function converts InStream to Text:

    TextFromStream_Txt(VAR vInS_InStream : InStream) Text : Text

    //S-000{

    vInS_InStream.READTEXT(lTxt_Buffer);

    Text += lTxt_Buffer;

    WHILE NOT vInS_InStream.EOS DO BEGIN

     vInS_InStream.READTEXT(lTxt_Buffer);

     Text += lDNe_Environment.NewLine + lTxt_Buffer;

    END;

    //S-000}

    Which:

    - lDNe_Environment.NewLine is DotNet System.Environment.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    - lTxt_Buffer is Text

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: BLOB in Email Body

    Hi Saurabh,

    So much appreciate for your reply.

    I did try above solution by converting the BLOB file into BigText, codes are written as below:

    NoteText - BigText

    Stream - InStream

    RecordLink.CALCFIELDS(Note);

    IF RecordLink.Note.HASVALUE THEN BEGIN

     CLEAR(NoteText);

     RecordLink.Note.CREATEINSTREAM(Stream);

     NoteText.READ(Stream);

     NoteText.GETSUBTEXT(NoteText, 2);

     StripNonNumeric(NoteText);

    END;

    But after this, what am i suppose to do to make NoteText able write into the mail body?

    As i see the function "AppendBody" from Codeunit "SMTP Mail" is only accept Text parameter. I hope to make this BLOB object show at mail body instead of as an attachment.

    Feel sorry because I'm just too new to the BLOB and BigText variables, don't really know how to play around with them :(

    Regards,

    TC

  • Verified answer
    Saurabh Shah Profile Picture
    Saurabh Shah 4,560 on at
    RE: BLOB in Email Body

    Hi

    Please follow below links for it

    dynamicsuser.net/.../5792.aspx

    msdn.microsoft.com/.../dd355099.aspx

    midynav.blogspot.in/.../how-to-read-blob-data-and-export-into.html

    These will might helpful to you to convert blob to text.

    Let me know if you are seeking at any more information.

    Regards,

    Saurabh Shah

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans