outlookmapi

What if I call GetProps immediately after SetProps in MAPI?


I have a question in MAPI.

If I invoke SetProps for a property, then without invoking the SaveChanges function, I invoke GetProps immediately for that property, what will happen?

Based on my own test, it seems that GetProps will get the proper property value even without SaveChanges.


Solution

  • Yes, you can do that just fine. SaveChanges only kicks in some property validation - e.g. if you set plain text PR_BODY, SaveChanges will update RTF and HTML body for HTML/RTF aware stores. SaveChanges will also populate PR_DISPLAY_TO/CC/BCC properties based on the recipient table (if you updated recipients).

    Other than that, GetProps will return the same properties set with SetProps without having to call SaveChanges.