Outlook 2007加载项-主题仅在失去焦点后才更新 [英] Outlook 2007 Add-In - subject only updates after losing focus

查看:52
本文介绍了Outlook 2007加载项-主题仅在失去焦点后才更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Outlook 2007制作一个插件,才刚刚开始.我添加了一个按钮,该按钮显示一个消息框,显示正在编写的电子邮件的主体和主题,并且似乎主题仅在该字段失去焦点时才更新,而主体则立即更新.如果用户要填写主体,则在主题仍位于主题字段上的同时单击主题并单击我的按钮,则它将不会收集任何内容作为主题内容.

I'm making a plugin for outlook 2007 and have only just started. I added a button that displays a messagebox showing the body and subject of the email being composed, and it seems as though the subject only updates once that field loses focus, while body updates immediately. If a user were to fill out the body, then the subject and click my button while the focus was still on the subject field then it would gather nothing as the subject content.

我正在简单地收集数据:

I'm gathering the data simply as:

If Not (mailItem Is Nothing) Then
If mailItem.EntryID Is Nothing Then
    body = mailItem.Body
    subject = mailItem.Subject
    MessageBox.Show("Subject is: " + subject + "| And body is: " + body)
End If
End If

有人知道解决方法吗?我曾考虑将焦点转移到身体,然后再转移到主体,如果焦点最初在那儿的话,但我对前景一点都不熟悉,有些快速搜索表明在前景中不可能改变焦点.

Does anyone know a workaround for this? I looked into changing the focus to the body and back to the subject if the focus was originally there but I'm not very familiar at all with outlook and some quick googling suggests that changing focus isn't possible in outlook.

推荐答案

尝试保存mailItem.有点像mailItem.Save()

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

如果您实际上不想这样做,则捕获mailitem.write事件,并将作为参考传递的 boolean cancel 设置为true.因此,该项目将不会保存,但主题应该更新.

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.

这篇关于Outlook 2007加载项-主题仅在失去焦点后才更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆