MailItem.PropertyChange stops firing

I am implementing custom taskbars with email messages in Outlook. The kernel is taken from this MSDN link (Walkthrough: Displaying Custom Taskbars with Emails in Outlook)

Added a handler for changing the property:

    void TaskPane_VisibleChanged(object sender, EventArgs e)
            {
                Globals.Ribbons[inspector].ManageTaskPaneRibbon
.toggleButton1.Checked = taskPane.Visible;
...some code here...

                mailItem.PropertyChange += PropertyChangeHandler;
            }

      

PropertyChangeHandler checks are receivers who have changed and do some heavy lifting with messages and so on. But ... If I add 10 recipients and start deleting them with backspace, the PropertyChangeHandler stops firing at some point. No mistakes. The buttons on the custom taskbar work fine.

What's wrong?

It seems that either the event has been eaten or the inspector is incorrect, but I cannot identify the problem and find a solution.

I also think it might be about a "heavy load" where the next event is fired before the previous one is completed, but that's an assumption

+3


source to share


1 answer


You need to call the Save or Save Message method explicitly to make the PropertyChange event . Outlook caches the values ​​in the user interface and does not commit changes until the item is saved.



Also I would suggest creating a log file (plain text file) where you can write debug statements. This way you will understand what is going on in the code.

0


source







All Articles