繁体   English   中英

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

[英]Create Task Pane Office Add-In for Outlook 2016

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

我的问题是,当选择新的Office Add In模板时,Visual Studio会询问此插件所针对的应用程序,如图所示, 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>

希望这有助于其他人帮助我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM