Get MSG property by property's hex name

Attachment:

[http://www.aspose.com/products/aspose.network/sample/support-case.zip](https://forum.aspose.com/products/aspose.network/sample/support-case.zip)

1. Thanks for fixing the date bug. One question though, I thought the date Mapi properties would always return GMT, I noticed that the date returned is actaully taken the time zone into consideration. Is there a way to get the original GMT?

iret: You can use the MapiProperty.Data to get the actual filetime. Actually, we convert the filetime by using the code as following:

long filetime = MapiProperty.GetLong();

return DateTime.FromFileTime(filetime);

Hi, Please use the latest private build.

I have resolved the issue to make the MailMessage can load the embedded outlook messages exported.

[http://www.aspose.com/products/aspose.network/releases/Aspose.Network3.5.1.4.zip ](https://forum.aspose.com/products/aspose.network/releases/Aspose.Network3.5.1.4.zip)

MapiMessage msg = MapiMessage.FromFile(@“embeddedA.msg”);

MapiAttachment att = msg.Attachments[0];

if (att.ObjectData.Data != null && att.ObjectData.Data.Length > 0)
{
using (System.IO.FileStream fs = System.IO.File.OpenWrite(@“embeddedObject.msg”))
{
fs.Write(att.ObjectData.Data, 0, att.ObjectData.Data.Length);
}
}

//load the embedded message use MailMessage, and save it to Mht

MailMessage emlmessage = MailMessage.Load(“embeddedObject.msg”, MessageFormat.Msg);
emlmessage.Save(“embeddedtest.mht”, MessageFormat.Mht);

Thank you for all the new features and fixes, I will try all of them shortly.

Here is an example (see attached) for the scenario two I talked about. How I generated this file is by using outlook to create a message, and choose Insert-> object->select tab "create from file" --> select file and select "Display as Icon" checkbox.

The example msg has a pdf doc embedded in it, I extracted the pdf (attached as well, named 0.pdf), but Adobe can't open it. It looks to me the extracted file has some type of wrapper to it.

As to the mht rendering of this scenario two, we hope the icon can be rendered. Basically we would like anything user can see in Outlook be rendered in mht.

Yes, It looks still some header on it. I am looking into this issue, I will get back to you soon.

For the mht rendering, we need to improve the Rtf->Html engine, which will handle most of the case you mentioned including your previous crash.

Thanks

I tried the mht part, it still returns an almost empty file. Could it be license issue? If one were to use evaluation license, is the mht rendered in full?

Thanks!

No, the evaluation copy can do the job, but inject some mark in the subject. Please double check:

1. Please make sure you have used the latest version of dll, v3.5.1.4.

2. Use the HtmlEmail.msg that you sent me before, I can export it properly use the v3.5.1.4

The attached mht is my output for HtmlEmail.msg, check it out to see if you can get the same.

Thanks,

Per your previous post for embedded Pdf document,

We have decoded the header being added to the pdf file. Now we can automatically detect the document type, if it is adobe pdf document, we do some extra document header removing. I will release a private built binary to you shortly. My outlook (office 2007) cannot make an embedded document showing icon. If you can provide me other document types, like ppt or CAD, it could be greatly appreciated. I tested about bmp, avi, they both embedded as a non Ole way.

But I think microsoft office files will work quit the same way. We just need to hack other Ole embedded document case by case.

Per your need on rendering the icon of the mail body in mht document, it seems we cannot provide any solutions. After the hacking of the icon disply in outlook messsage, we found microsoft uses local path to identify the document icon itself. No icon pic is embedded into the Outlook message. They all depend on the local machine settings. Therefore, it is a little difficult to render the icon by ourself.

Some data from the msg file shows the icon depends on local system.

0012C9CC 00 00 04 00 00 00 06 00 00 00 08 00 00 00 06 00 |................|
0012C9DC 00 00 06 00 00 00 06 00 00 00 06 00 00 00 06 00 |................|
0012C9EC 00 00 06 00 00 00 03 00 00 00 06 00 00 00 02 00 |................|
0012C9FC 00 00 02 00 00 00 06 00 00 00 04 00 00 00 06 00 |................|
0012CA0C 00 00 06 00 00 00 04 00 00 00 25 00 00 00 0C 00 |..........%.....|
0012CA1C 00 00 0D 00 00 80 46 00 00 00 20 00 00 00 12 00 |......F... .....|
0012CA2C 00 00 49 00 63 00 6F 00 6E 00 4F 00 6E 00 6C 00 |..I.c.o.n.O.n.l.|
0012CA3C 79 00 00 00 00 00 46 00 00 00 80 00 00 00 72 00 |y.....F.......r.|
0012CA4C 00 00 43 00 3A 00 5C 00 44 00 6F 00 63 00 75 00 |..C.:.\.D.o.c.u.|
0012CA5C 6D 00 65 00 6E 00 74 00 73 00 20 00 61 00 6E 00 |m.e.n.t.s. .a.n.|
0012CA6C 64 00 20 00 53 00 65 00 74 00 74 00 69 00 6E 00 |d. .S.e.t.t.i.n.|
0012CA7C 67 00 73 00 5C 00 62 00 62 00 61 00 69 00 5C 00 |g.s.\.b.b.a.i.\.|
0012CA8C 44 00 65 00 73 00 6B 00 74 00 6F 00 70 00 5C 00 |D.e.s.k.t.o.p.\.|
0012CA9C 45 00 6D 00 62 00 65 00 64 00 64 00 65 00 64 00 |E.m.b.e.d.d.e.d.|
0012CAAC 20 00 46 00 69 00 6C 00 65 00 2E 00 70 00 64 00 | .F.i.l.e...p.d.|
0012CABC 66 00 00 00 00 00 46 00 00 00 64 00 00 00 56 00 |f.....F...d...V.|
0012CACC 00 00 43 00 3A 00 5C 00 50 00 72 00 6F 00 67 00 |..C.:.\.P.r.o.g.|
0012CADC 72 00 61 00 6D 00 20 00 46 00 69 00 6C 00 65 00 |r.a.m. .F.i.l.e.|
0012CAEC 73 00 5C 00 41 00 64 00 6F 00 62 00 65 00 5C 00 |s.\.A.d.o.b.e.\.|
0012CAFC 41 00 63 00 72 00 6F 00 62 00 61 00 74 00 5C 00 |A.c.r.o.b.a.t.\.|
0012CB0C 41 00 63 00 72 00 6F 00 62 00 61 00 74 00 2E 00 |A.c.r.o.b.a.t...|
0012CB1C 65 00 78 00 65 00 00 00 00 00 46 00 00 00 10 00 |e.x.e.....F.....|
0012CB2C 00 00 04 00 00 00 00 00 00 00 46 00 00 00 20 00 |..........F... .|
0012CB3C 00 00 12 00 00 00 49 00 63 00 6F 00 6E 00 4F 00 |......I.c.o.n.O.|
0012CB4C 6E 00 6C 00 79 00 00 00 00 00 0E 00 00 00 14 00 |n.l.y...........|
0012CB5C 00 00 00 00 00 00 10 00 00 00 14 00 00 00 04 00 |................|
0012CB6C 00 00 03 01 08 00 05 00 00 00 0B 02 00 00 00 00 |................|
0012CB7C 05 00 00 00 0C 02 42 00 66 00 05 00 00 00 09 02 |......B.f.......|
0012CB8C 00 00 00 00 05 00 00 00 01 02 FF FF FF 00 05 00 |................|
0012CB9C 00 00 09 02 00 00 00 02 04 00 00 00 02 01 01 00 |................|
0012CBAC 1C 00 00 00 FB 02 F5 FF 00 00 00 00 00 00 90 01 |................|
0012CBBC 00 00 00 00 00 40 00 22 54 61 68 6F 6D 61 00 00 |.....@."Tahoma..|
0012CBCC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012CBDC 00 00 00 00 00 00 00 00 04 00 00 00 2D 01 00 00 |............-...|
0012CBEC 25 00 00 00 32 0A 22 00 06 00 11 00 04 00 00 00 |%...2.".........|
0012CBFC 00 00 66 00 42 00 43 3A 5C 44 6F 63 75 6D 65 6E |..f.B.C:\Documen|
0012CC0C 74 73 20 61 6E 64 20 00 07 00 04 00 04 00 07 00 |ts and .........|
0012CC1C 06 00 05 00 06 00 08 00 06 00 06 00 04 00 05 00 |................|
0012CC2C 03 00 06 00 06 00 06 00 03 00 46 00 00 00 32 0A |..........F...2.|
0012CC3C 2F 00 00 00 27 00 04 00 00 00 00 00 66 00 42 00 |/...'.......f.B.|
0012CC4C 53 65 74 74 69 6E 67 73 5C 62 62 61 69 5C 44 65 |Settings\bbai\De|
0012CC5C 73 6B 74 6F 70 5C 45 6D 62 65 64 64 65 64 20 46 |sktop\Embedded F|
0012CC6C 69 6C 65 2E 70 64 66 00 06 00 06 00 04 00 04 00 |ile.pdf.........|
0012CC7C 02 00 06 00 06 00 05 00 04 00 06 00 06 00 06 00 |................|
0012CC8C 02 00 04 00 07 00 06 00 05 00 05 00 04 00 06 00 |................|
0012CC9C 06 00 04 00 06 00 08 00 06 00 06 00 06 00 06 00 |................|
0012CCAC 06 00 06 00 03 00 06 00 02 00 02 00 06 00 04 00 |................|
0012CCBC 06 00 06 00 04 00 1C 00 00 00 FB 02 10 00 07 00 |................|
0012CCCC 00 00 00 00 BC 02 00 00 00 00 01 02 02 22 53 79 |............."Sy|
0012CCDC 73 74 65 6D 00 00 00 00 00 00 00 00 00 00 00 00 |stem............|

For the embedded Outlook message, we are still working on the header hacking and analysis. We cannot get the key by now.

However, you can use MapiMessage to load the extracted embedded outlook message.

Thanks

Thanks you for your quick responses!

Attached please find other file types I embedded in msg. They are .ppt (is .pps and .pot treated the same, I included them as well), .txt, .msg.

If rendering the icons exactly as they show in the message is difficult, is it possible to replace it with some generic icon? So that at least the we can tell where in the message a ole object is inserted.

1. Yes, It is possible. Maybe we can insert some text or other common icon to identify the embedded Ole object in the mht.

Is it reasonable?

2. All of the embedded object is stored in storage document format. How do you think if we expose more document details, therefore you guys can be able to create custom document extracting? For example, a StorageStream class, which can access the document by low level supports.

Thanks,

  1. I think inserting some text is definitely reasonable. Maybe something like <OLE:filename> which denotes an OLE file was embedded at that spot. Does that work?

    2. Can you support the MS Office( Excel, Word, PPT, Visio) and PDF file types by default and then also supply the StorageStream for other file types? If so I think that is actually a good plan. I am guessing that if the file type is “Package” we would then use the StorageStream to then do any custom extraction, is that correct?

    Thanks

1. Yes, we will add this feature as soon as possible.

2. For MS office, PDF file types, we will provide built-in support -- their document content will be extracted properly. Besides, we will also expose a StorageStream for the OLE file, therefore you can do custom extraction. We will also try to guess the type of document like MSOffice, PDF or Unknow if possible.

Thanks

Hi, the EmbeddedOleFiles.rar that you sent me is a MSWord document.

Could you provide me a MS outlook message document?

Thanks a lot.

Oops, here you go. Thanks!

Is there a way to get the file name or file extension of the embedded MS office types or Pdf, so that we will know what extension to give when saving the files?

Thanks!

I still can't make the mht generated properly. I checked the version, it is 3.5.1.4. Attached please find the dll, the mht generated and the msg. The pattern of the mht content is that it is almost empty, only the date field is populated and its valued is the time when the mht is generated.

Here is my code:

MailMessage message = new MailMessage();

MailMessage.Load(inputPath, MessageFormat.Msg);

string outputFilePath = EmailParserUtil.GetOutputMhtFilePath(inputPath, outputFolder);

if (Directory.Exists(outputFolder) == false)

{

Directory.CreateDirectory(outputFolder);

}

message.Save(outputFilePath, MessageFormat.Mht);

'Check it out. The MailMessage.Load returns a new instance of MailMessage class. Please use it to get the mailmessage instance, instead of creating it using contructor.

MailMessage message = MailMessage.Load(inputPath, MessageFormat.Msg);

string outputFilePath = EmailParserUtil.GetOutputMhtFilePath(inputPath, outputFolder);

if (Directory.Exists(outputFolder) == false)

{

Directory.CreateDirectory(outputFolder);

}

message.Save(outputFilePath, MessageFormat.Mht);

Thanks, I was able to get the same result as yours.

I tried generating mht for messages that has attachments to it, I noticed that the attachments are not rendered in the mht. Here are two scenarios I tried:

1. Message in Html format: the attachments (the icon and the file name) are expected to get rendered in the header.

2. Message in Rtf format: the attachments (icon and file name) are expected to get rendered inline within the message.

I have attached an example for each cases and the current mht output I generated.

Thank you!

Hello,

We are still working on the Rtf engine. It takes more time as we expected. We have to write a Rtf parser and html writer.

Here is the latest built,

  • Add OleDocumentFormat for indicating the file format of the Ole document
  • Add supporting for Package type Ole document
  • Beta Rtf render engine
  • Embedded image in the body is still not supported in this version. However, I fixed the crash in it.

[http://www.aspose.com/productsAspose.Network/Releases/Aspose.Network_beta_v3515.zip](https://forum.aspose.com/productsAspose.Network/Releases/Aspose.Network_beta_v3515.zip)

For your scenarios, we will discuss and get back to you soon,

Thanks,