Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue saving an attached .msg from within an outlook .msg file #331

Closed
dariuslf opened this issue Mar 21, 2023 · 3 comments
Closed

Issue saving an attached .msg from within an outlook .msg file #331

dariuslf opened this issue Mar 21, 2023 · 3 comments
Assignees

Comments

@dariuslf
Copy link

Hi, I've discovered something when saving attachments from outlook .msg files.

If the attachment is itself a .msg compound file, you represent it as a Storage.Message instance, which is great. When I call .Save() on such an instance, you create a new CompoundFile (see Message.cs line 1896) and copy the relevant streams and properties over. So far so good.

I have however been alerted to the fact an email scanner is detecting issues with such saved message files if they are sent as attachments. Having carefully varied the versions of this library and the referenced OpenMcdf library, I was able to narrow the issue down to a change in OpenMcdf version 2.2.1.9 which no longer initialises the CLSID of a storage - in this case the new root - to a non-empty GUID.

Prior to OpenMcdf 2.2.1.9, the CLSID was assigned a new GUID. See ironfede/openmcdf#68 and ironfede/openmcdf@949e5ce.

Apparently this makes the OpenMcdf implementation more compliant, but a side effect is that such attached .msg files are now saved with a root-level CLSID of 00000000-0000-0000-0000-000000000000 instead of the random new GUID previously. I believe that the correct value would be CLSID_MailMessage: {00020D0B-0000-0000-C000-000000000046}.

I think a solution would be to set this CLSID in the root storage of the new compound file when creating it. Maybe around line 1898. Maybe you have a better solution.

As a workaround, I'm loading the file saved from the attached .msg into a CompoundFile, setting the CLSID and resaving. This has resolved my issue with the mail scanner.

@Sicos1977 Sicos1977 self-assigned this Mar 22, 2023
@Sicos1977
Copy link
Owner

I added this line in the 4.5.1 nuget package... Please check if this solves the issue

compoundFile.RootStorage.CLSID = Guid.Parse("00020D0B-0000-0000-C000-000000000046");

@dariuslf
Copy link
Author

This seems to have solved the issue.
Thank you very much once again!

@Sicos1977
Copy link
Owner

Good to hear that the issue is solved by adding the GUID. If you did not make an issue for this I would never have known that this was a new issue because of some changes in OpenMCDF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants