Possible to load in an email in MSG file format, modify content of selected attachments, save back as MSG file?

Okay, my bad - it does allow setting the property value.

Now, testing with simple MSG files attached:

asposetest.zip (107.8 KB)
test.zip (40.5 KB)

With simple code as follows, i.e. just loading the MSG file and then saving it right back:

            using Metadata metadata = new(msgFile);
            MsgRootPackage root = metadata.GetRootPackage<MsgRootPackage>();
            MsgPackage msg = root.EmailPackage;
            metadata.Save();

For the 1st MSG test file, the above causes the MSG content to become messed up.

For the 2nd MSG test file, the Save fails with exception:

Error: The data of attachment can’t be null.
Parameter name: data
at Aspose.Email.Mapi.MapiAttachmentCollection.Add(String name, Byte[] data)
at GroupDocs.Metadata.Formats.Email.MsgRootPackage.(MsgPackage )
at GroupDocs.Metadata.Formats.Email.MsgRootPackage.pfq4rhh3tnxzrhuh6z5nyqfxm3nvff3j?? ?(Stream )

@jarrodwee

Can you please clarify if you were using GroupDocs.Metadata or GroupDocs.Total in this case?

GroupDocs.Metadata.NETFramework 25.3

@jarrodwee

Thank you for the update. We’re looking into this issue.

Any updates on this issue?

Noticed that with GroupDocs.Total.NETFramework 25.7, the original HTML Body is not retained when simply calling Save - it appears to have been simplified and embedded images are missing.

Also noticed that the PR_SENT_REPRESENTING_NAME_W property changed from simply “Jarrod Wee” to “Jarrod Wee </O=EXCHANGELABS/OU=EXCHANGE…>”

@jarrodwee

As I can see all the issues linked to this topic were resolved. Can you please clarify what code you’re running and what source file is used?

Samples and source code in my post above dated 9th April.

@jarrodwee

Got it, thank you! Will take a look and update you.

Just tested with GroupDocs.Total.NETFramework 25.9 with the asposetest.msg sample which I provided on 9th April.

Attached are screenshots of the output when simply loading the msg sample and then saving it back out using the sample code that was provided back then.

image.png (135.1 KB)

image.png (93.8 KB)

As per observations in 27th Aug, the screenshots show the following:

The original HTML Body is not retained when simply calling Save - it appears to have been simplified and embedded images are missing.

The PR_SENT_REPRESENTING_NAME_W property changed from simply “Jarrod Wee” to “Jarrod Wee </O=EXCHANGELABS/OU=EXCHANGE…>”

Please advise if these issues are being looked into as we are looking at the feasibility of switching completely to GroupDocs.Total for our projects.

@jarrodwee

It looks like the issues attached to this topic have already been resolved. Let me take another look at this scenario in the context of GroupDocs.Total.

Since you were previously using the .NET Framework, could you clarify whether you plan to work with GroupDocs.Total (.NET) or the GroupDocs.Total.NETFramework package?

Also, are there any other issues that might be blocking your transition to GroupDocs.Total?

GroupDocs.Total.NETFramework, thanks.

For now, transitioning completely to GroupDocs.Total is impossible because the basic functionality of loading in a MSG file, accessing the EmailPackage, and then simply saving it back without any modification doesn’t work at all.

I’m quite certain there will be other hurdles to overcome once we are able to start with testing it proper.

1 Like