Home Saved Outlook MailItem does not yet have EntryId

Saved Outlook MailItem does not yet have EntryId

user4869
1#
user4869 Published in September 19, 2018, 3:17 am

This is a weird one.

I have a saved Outlook MailItem (.msg file) opened from outside of Outlook, that for some reason does not yet have its EntryID set:

Some context:

• This MailItem is a saved .msg file opened from Windows Explorer, not from Outlook.
• In my code, I originally start at the attachment and then get the MailItem as its parent.

If I inspect the MailItem while debugging, the EntryID is either null or an empty string...

... BUT if (for example) I expand m_ObjectToDataMap until I get to _rcw and expand that object's Dynamic View - that is when the EntryID gets set.

It's as if the MailItem isn't fully loaded yet, and some inspection of the values in the debugger somehow completes the initialization of the MailItem.

I have tried:

• Waiting a few seconds with System.Threading.Thread.Sleep().
• parent.Save() even though I know this is not a new MailItem being composed.
• refreshing the active inspector.
• attempting to get the MailItem via other methods instead of getting it off the attachment.

None of these fix the problem. Why does this happen? How would I fix or get around this issue? Any help would be much appreciated.