Embedding Outlook Email (.msg file) into Word Document using Aspose

Hi guys, I am looking for a code to embed outlook Email file(.msg) also .eml file into Word document…

I had been trying up below code but it is not helping me out…

Dim Doc As Document = New Document()
Dim Fs As FileStream
Fs = File.OpenRead("C:\Tmp\testemail.msg")
Dim objOLE As Shape
objOLE = stringBuilder.InsertOleObject(Fs, "Outlook.File.msg.14", True, Nothing)
Fs.Close()

Hi Amanda,

Thanks for your inquiry. Please try executing the following code:

Dim doc As New Document(MyDir & "in.docx")
Dim builder As New DocumentBuilder(doc)
Dim oleObject As Shape = builder.InsertOleObject(MyDir + "sample.msg", False, True, Nothing)
doc.Save(MyDir & "out.docx")

I hope, this helps.

Best regards,