We recently resolved a case here where a customer, as part of their larger application, was using SetReceiveFolder to direct messages of their message class to the correct folder so their application could do further processing on them. However, when they tested their application in cached mode, it didn’t work. The SetReceiveFolder call would return S_OK, but the mail would continue to be delivered to the Inbox.
After some investigation, we found that Outlook does not appear to honor SetReceiveFolder settings made on the OST when it synchronizes mail from Exchange. Fortunately, there’s an easy workaround: make the setting on the server instead! Even though this customer was targeting Office 365, which only allows cached mode profiles, it’s still possible to access the server directly to make the call. The trick is to use MAPI_NO_CACHE, as demonstrated here. Once they opened the folder on the server, they were able to make the SetReceiveFolder call and the server would then honor it during message delivery.
Incidentally, we were able to test all of this using MFCMAPI, which has under Tools/Options the switches needed to bypass the cache, and which has the ability to both set receive folders and view the receive folder table. I knew writing that code would pay off!
The June 2012 Release (build 22.214.171.1244) is live: http://mfcmapi.codeplex.com.
This month we ship some pretty cool additions to MrMAPI: the –store flag gets a turbo boost, allowing you to open a store by Entry ID, which helps some of the automated diagnostics out there that use MrMAPI for data gathering. Also new is the ability to look up a specific property for a store, also by request of the diagnostics authors. For the troubleshooters out there who use MrMAPI for property lookup, check out the –flag switch, which allows you to look up flags on the fly.
Here's a change list - see the Issue Tracker on Codeplex for more details, or look at the code:
Finally – Surface!