2
votes

I have a same question as Bryan had in thread Outlook 2007 Add-In - subject only updates after losing focus ... I am using vsto for outlook programming, i am using button controls of outlook ribbon bar on a compose mail window, the button creates a work item from email for tfs, the work item uses subject of an email for its title field.. Now the problem occurs here when i update the subject of an email and clicks the button on Ribbon bar the work item is created with the old value of subject because ribbon button click does not have an effect on Subject focus lost ... I searched alot but found out nothing relevant .. Is there any solution to lost the focus of Email Subject when the button on the ribbon bar clicks??

3

3 Answers

1
votes

All Outlook Object Model properties, be that Subject, Recipients, etc. are updated only after the corresponding control loses focus. The only workaround is to use the accessibility API to access the actual control.

1
votes

Try to save mailItem. Smth like mailItem.Save()

If you actually do not want to, then catch mailitem.write event and set boolean cancel, which passed as a reference, to true. Therefore the item will not be saved but subject should be updated.

0
votes

Use a SendKey command and send tab in your save/send/write event handler.