Thursday, April 26, 2012 1:52 PM
I'm trying to set follow up flags on a message using the MAPI interface.
I set the properties below (mirroring what outlook does when you choose Flag->No Date) using SetProps.
PR_FOLLOWUP_ICON=6, PR_TODO_ITEM_FLAGS= existing flags | 1(todoTimeFlagged), PidLidToDoOrdinalDate=current time, PidLidToDoSubOrdinal=current subject, PidLidTaskComplete=false, PidLidTaskStatus=0, PidLidPercentComplete=0.0, PidLidFlagRequest="Follow Up", PidLidFlagString=3, PidLidValidFlagStringProof=Message Delivery Time, PR_FLAG_STATUS=2, PR_REPLY_REQUESTED=true, PR_RESPONSE_REQUESTED=true
In outlook the red flag appears , but in the preview pane I don't see the blue "Follow up" banner, and clicking on the item and choosing "Clear Flag" does nothing. If I restart Outlook then the blue banner does appear and I can choose "Clear Flag" to clear the flag
Does anyone know how I can get the flag to appear correctly via MAPI only - not using the Outlook object model?
Tuesday, May 01, 2012 7:59 AMModerator
Thanks for posting in the MSDN Forum.
I will involve some experts into this issue to see whether they can solve it. There might be some time delay, appreciate for you patience.
Have a good day,
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
Tuesday, May 01, 2012 4:06 PMAnswererDid you have the item selected in the UI while you were setting those properties via MAPI? What happens if you do not have the item selected when you set them? Does everything update as expected then? You note that restarting Outlook changes the behavior - does it "fix" the problem? If so, does switching folders and then switching back also "fix" the problem?
Wednesday, May 02, 2012 7:05 AM
I've tried with item selected and with item not selected. It behaves as described above in both cases. Restarting Outlook does seem to fix the problem but that's not an acceptable solution for my use case. If I use Outlook spy and compare the message properties before and after restarting Outlook, the message is identical so it's not as if Outlook has fixed something
Switching folders, changing the folder view makes no difference.
Wednesday, May 02, 2012 7:14 AM
If Outlook caches the item, you are out of luck - it will keep the stale data for as long as it can.
The best you can do is make sure that you do not hold an outstanding reference to an Outlook object. This way Outlook will release the item when you deselect it. Do you do that?
Still, your mileage will vary greatly, especially if you deal with appointments.
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.3 is now available!
- Marked As Answer by Huw Thomas Wednesday, May 02, 2012 7:37 AM
Wednesday, May 02, 2012 7:36 AM
I think you've got it.
In order to test my MAPI stuff, I used a COM Add-In to call my C++ code. Once I added Marshal.ReleaseComObject calls to every outlook interface I had, the behaviour improved. If I'm on the current item I still don't see it in the preview but if I move away and back again then the banner displays property and I can clear the flag via the UI. I think that's good enough for me.
Thanks very much,