为 Outlook 2016 创建任务窗格 Office 加载项

Create Task Pane Office Add-In for Outlook 2016

我正在尝试为 Outlook 2016 创建加载项。在以前版本的 Office 中,这是使用 WinForms UserControl 完成的,非常简单。但是,Visual Studio 2015 中现在有通用模板用于我想使用的 Office 加载项,而不是 Outlook VSTO 加载项(均显示 here).

我的问题是,选择新的 Office添加模板,Visual Studio然后询问此插件的应用程序是什么,并且如图所示,没有 option for Outlook.

那么,我想知道如何使用新的 Office 模板为 Outlook 2016 创建自定义任务窗格?

很抱歉图片链接,我还没有足够的代表直接将它们添加到问题中。谢谢!

GitHub 上有一个示例解决方案。在此示例中,使用了 JavaScript 和 HTML。这是从所选电子邮件中提取数据的 JavaScript 示例:

  Office.initialize = function (reason) {
    $(document).ready(function () {
        app.initialize();

        loadProps();
    });
};

   function loadProps() {
  var item = Office.context.mailbox.item;

  $('#dateTimeCreated').text(item.dateTimeCreated.toLocaleString());
  $('#dateTimeModified').text(item.dateTimeModified.toLocaleString());
  $('#itemClass').text(item.itemClass);
  $('#itemId').text(item.itemId);
  $('#itemType').text(item.itemType);

  if (item.itemType == Office.MailboxEnums.ItemType.Message){
    loadMessageProps(item);
  }
  else {
    loadAppointmentProps(item);
  }
}

然后链接到 HTML 页面以显示数据。为了将此添加到 Outlook,还有一个 XML 清单文件。这告诉 outlook 在哪里可以找到页面,这里是文件的一个片段:

<Requirements>
  <bt:Sets DefaultMinVersion="1.3">
    <bt:Set Name="Mailbox" />
  </bt:Sets>
</Requirements>
<Hosts>
  <Host xsi:type="MailHost">
    <DesktopFormFactor>
      <!-- Message read form -->
      <ExtensionPoint xsi:type="MessageReadCommandSurface">
        <OfficeTab id="TabDefault">
          <Group id="msgReadDemoGroup">
            <Label resid="groupLabel" />
            <Tooltip resid="groupTooltip" />
            <!-- Task pane button -->
            <Control xsi:type="Button" id="msgReadOpenPaneButton">
              <Label resid="paneReadButtonLabel" />
              <Tooltip resid="paneReadButtonTooltip" />
              <Supertip>
                <Title resid="paneReadSuperTipTitle" />
                <Description resid="paneReadSuperTipDescription" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="green-icon-16" />
                <bt:Image size="32" resid="green-icon-32" />
                <bt:Image size="80" resid="green-icon-80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                <SourceLocation resid="readTaskPaneUrl" />
              </Action>
            </Control>
          </Group>
        </OfficeTab>
      </ExtensionPoint>

希望这对其他人有所帮助,就像对我有所帮助一样。