在内联响应下更新时,Outlook.MailItem.HTMLBody不刷新 [英] Outlook.MailItem.HTMLBody doesn't refresh when updated under inline response
问题描述
当为内联响应设置MailItem.HTMLBody
时,有时永远不会显示更新的正文.如果我呼叫MailItem.Save()
,有时会显示出来,但仅在保存的草稿预览下显示.有人知道强制更新的HTMLBody呈现的方法吗?
When setting MailItem.HTMLBody
for a inline response, sometimes the updated body never gets displayed. If I make a call to MailItem.Save()
, sometimes it shows up but only under saved draft preview. Does anyone know of a way to force the updated HTMLBody to render?
一些其他发现:
- 对于仅包含纯文本的电子邮件(但
MailItem.BodyFormat
是OlBodyFormat.olFormatHTML
),这种情况总是会发生. - 对于带有HTML内容和图像的电子邮件,如果用户在回复时选择下载外部内容,则会发生这种情况
- 对于带有HTML内容和图像的电子邮件,如果用户选择不下载外部内容,则不会发生这种情况
- For emails with only plain text (but
MailItem.BodyFormat
isOlBodyFormat.olFormatHTML
), this always happens. - For emails with HTML content and images, this happens if user chooses to download external content when replying
- For emails with HTML content and images, this does NOT happen if user chooses not to download external content
我尝试使用不同的路由通过浏览器获取MailItem,它们都导致相同的结果.这是我尝试过的不同方法,以防万一我错过了任何事情:
I have tried to use different routes to get the MailItem through the explorer and they all lead to the same results. Here are the different methods I've tried, in case I missed anything:
- 通过Outlook.Application.Explorers.NewExplorer事件处理程序arg
- 通过
ActiveInlineResponse
属性
explorer = OutlookApp.ActiveExplorer();
explorer = OutlookApp.ActiveExplorer();
response = explorer.ActiveInlineResponse;
response = explorer.ActiveInlineResponse;
- 通过
InvokeMember("ActiveInlineResponse"...
explorer = OutlookApp.ActiveExplorer();
explorer = OutlookApp.ActiveExplorer();
response = explorer.GetType().InvokeMember("ActiveInlineResponse", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public,null,explorer,null)作为MailItem;
response = explorer.GetType().InvokeMember("ActiveInlineResponse", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, explorer, null) as MailItem;
环境:
- Office版本:16.0.10827.20118
- Windows 10
- Office 2007主要互操作性
- VSTO 2010
推荐答案
对于那些感兴趣的人,我发现了导致这种现象的原因.它没有完全解释潜在的问题,但至少我们有一种解决方法.
For those interested, I found what causes this behavior. It doesn't fully explain the underlying problem but at least we have a workaround.
在设置HTMLBody之前,我们访问了文档以通过Document doc = MailItem.GetInspector.WordEditor
检索选定的文本.
Prior to setting HTMLBody, we accessed the document to retrieve selected text through Document doc = MailItem.GetInspector.WordEditor
.
将其更改为Document doc = ActiveExplorer.ActiveInlineResponseWordEditor
消除了上述问题.
Changing this to Document doc = ActiveExplorer.ActiveInlineResponseWordEditor
eliminated the issue described above.
这篇关于在内联响应下更新时,Outlook.MailItem.HTMLBody不刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!