Outlook email subject only updating after loosing focus

℡╲_俬逩灬. 提交于 2020-01-15 04:52:05

问题


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??


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/22945693/outlook-email-subject-only-updating-after-loosing-focus

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!