Sicos1977 / MSGReader

C# Outlook MSG file reader without the need for Outlook
http://sicos1977.github.io/MSGReader
MIT License
489 stars 168 forks source link

adding reactions headers to html render of .msg files #377

Closed matt1liu closed 1 year ago

matt1liu commented 1 year ago

This PR is to add reactions data as headers in the HTML rendering of emails in .msg format, if they are requested. There are two reaction-related MAPI properties I want to expose:

  1. ReactionsSummary- this property contains the list of reactions on the email when downloaded. if someone modifies their reaction, ReactionsSummary will only contain their latest reaction (if their latest "reaction" is to remove their reaction, there is no record of that user).
  2. OwnerReactionHistory- this property contains the reaction history of the mailbox owner as a list of reactions. When someone overrides their reaction on an email, it will be added to the OwnerReactionHistory.

If the user requests reactions via ExtractMsgEmailBody or ExtractToFolder, the following headers will be added to the html

Label- ReactionsSummary, RowText- List of Reactions Label- OwnerReactionHistory, RowText- List of Reactions.

Each Reaction will be represented like:

, , , \n e.g. John Doe, johndoe@company.org, celebrate, 10/19/2023 10:36:00 PM Additionally: In the process, I found that I was unable to access named properties without specific proptag hex numbers. I ran into two issues: 1. The named property key was not being isolated, so accessing property by name was not able to be mapped. The key for a named MAPI prop like ReactionsSummary previously looked like: "ReactionsSummary^X-MS-Exchange-Organization-ATPSafeLinks-MsgData ReactionsHistory@AntispamSafelinksIsIntraOrgEmail:FocusedInboxSubjectEmbeddings". I identified behavior in the string stream to isolate property name, see changes to MapiTagMapper. 2. After making above change, we were now able to map name to its propTag, but prop identifier would be converted back to its name in the code. see changes to Storage for fix. Please let me know if I can clarify expand on any of these changes. thanks
Sicos1977 commented 1 year ago

Looks good to me. Thanks for doing this work.