2

I'm using Redemption to interact with Outlook emails in C#. Do I need to call RDOMail.Save after setting a value to RDOMail.Fields?

rdoMail.Fields["MyProperty"] = "MyValue";
rdoMail.Save(); // not sure if this is necessary

During my testing, it seems that even If I don't call the save method, my custom property value was able to be loaded out later by accessing rdoMail.Fields["MyProperty"] again. But I can't be sure that this is 100% the case. Outlook always seems a bit moody to me :P

I'd also like to know if this custom property value would be persisted if I save the email to a .msg file using Outlook.

Leon Zhou
  • 633
  • 6
  • 20
  • How is RDOMail object retrieved? – Dmitry Streblechenko Jan 11 '17 at 15:32
  • It's mostly retrieved via `GetRDOObjectFromOutlookObject` and occasionally via `GetMessageFromID`. Sounds like there are differences between the 2? – Leon Zhou Jan 11 '17 at 22:15
  • 1
    Yes, in case of GetRDOObjectFromOutlookObject you are sharing the message with OOM and OOM most likely calls Save, right? GetMessageFromID gives you a completely independent message, so it is your responsibility to call Save. – Dmitry Streblechenko Jan 11 '17 at 23:50
  • I'm not an expert of the OOM, I had no idea that it would call `Save` automatically. Because in my code, even it gets the `RDOMail` from an existing `MailItem` there is no code to call neither `RDOMail.Save` nor `MailItem.Save` and my custom property value still gets persisted from time to time. I say from time to time now because I've just ran into one computer running Outlook 2016 that it never persist the value unless my code explicitly calls the `Save` method on the `RDOMail` returned from `GetRDOObjectFromOutlookObject`. Outlook really feels unpredictable on this part. – Leon Zhou Jan 12 '17 at 00:25

0 Answers0