Outlook 的 Explorer.ActiveInlineResponse 属性 return 什么时候为空?

When does Outlook's Explorer.ActiveInlineResponse property return null?

我正在尝试确定 Outlook 的 Explorer.ActiveInlineResponse 属性 何时会 return 为空。 documentation link 状态,“如果在阅读窗格中没有内联响应可见,则此 属性 returns 为 Null(在 Visual Basic 中为空)”

到目前为止,当从 Outlook 外部发送邮件时,我只能将 ActiveInlineResponse 设置为 return null。例如,Word/Excel 邮件合并或来自使用 Outlook 发送邮件的 VBA 项目。是否还有任何其他情况下 ActiveInlineResponse 将 return 为空? 我只关心 Outlook mailitems。

这是我在代码中的问题-

        Outlook.Explorer explorer = Globals.ThisAddIn.Application.ActiveExplorer();
        explorer = Globals.ThisAddIn.Application.ActiveExplorer();
        Outlook.MailItem mailItem = Item as Outlook.MailItem;

        if (explorer.ActiveInlineResponse is Outlook.MailItem)
        {
            if (explorer.ActiveInlineResponse == null)
            {
                //When would the ActiveInlineResponse be null?
            }

            else if (explorer.ActiveInlineResponse != null)
            {
                //ActiveInlineResponse is not null when an item is being composed inline (reply,reply all or forward)
            }
        }

谢谢!

当然 - 这是意料之中的:Word/Excel 等不使用内联响应发送消息,它们在单独的检查器中显示消息,可以使用 Application.ActiveInspector 检索。

内联响应 (Application.ActiveExplorer.ActiveInlineResponse) 仅在用户回复或转发消息时显示。

首先,代码中没有两次调用ActiveExplorer方法:

Outlook.Explorer explorer = Globals.ThisAddIn.Application.ActiveExplorer();
explorer = Globals.ThisAddIn.Application.ActiveExplorer();

要在 Outlook 的资源管理器中获取当前选定的项目 windows 您可以使用 Selection 属性 的 Explorer class 其中 returns 一个 Selection 对象,其中包含在资源管理器 window 中选择的一个或多个项目。例如:

private void DisplaySelectedItems()
{
    Outlook.Selection selection =
        Application.ActiveExplorer().Selection;
    for (int i = 1; i <= selection.Count; i++)
    {
        OutlookItem myItem = new OutlookItem(selection[i]);
        myItem.Display();
    }
}

Explorer.ActiveInlineResponse 属性 returns 表示资源管理器阅读窗格中活动内联响应项目的项目对象(如其所述,它可用于任何响应,如回复和转发)。

您可能会发现以下文章有帮助: