无法启动加载项

时间:2017-07-31 13:28:54

标签: outlook ms-office outlook-addin office-js

我正在为Outlook开发一个加载项,我按照创建加载项的基本步骤进行操作,但每当我运行(未经编辑的预生成)项目时,我都会收到以下错误:

  

无法启动此加载项。关闭此对话框以忽略该问题,或单击“重新启动”以重试。

我首先想到这可能与Visual Studio ISS的HTTPS证书有关,但在安装之后(并测试它们在Chrome中的工作情况)。我还更改了徽标,看看它是否有任何效果,但它会一直显示默认图像。

有谁知道我做错了什么?这是我目前的清单:

<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<OfficeApp 
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" 
  xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0" 
  xsi:type="MailApp">

  <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

  <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
  <Id>d2240a8c-b832-493e-8056-5a14ca48a3f3</Id>

  <!--Version. Updates from the store only get triggered if there is a version change. -->
  <Version>1.0.0.0</Version>
  <ProviderName>DearBytes B.V.</ProviderName>
  <DefaultLocale>nl-NL</DefaultLocale>
  <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
  <DisplayName DefaultValue="Test" />
  <Description DefaultValue="Test"/>
  <IconUrl DefaultValue="~remoteAppUrl/Images/icon64.png"/>

  <SupportUrl DefaultValue="https://www.test.com/" />
  <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
  <AppDomains>
    <AppDomain>*.test.com</AppDomain>
    <AppDomain>*.test.nl</AppDomain>
  </AppDomains>
  <!--End Basic Settings. -->

  <Hosts>
    <Host Name="Mailbox" />
  </Hosts>
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1" />
    </Sets>
  </Requirements>
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="~remoteAppUrl/MessageRead.html"/>
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteItem</Permissions>
  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
  </Rule>
  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
      <bt:Sets DefaultMinVersion="1.3">
        <bt:Set Name="Mailbox" />
      </bt:Sets>
    </Requirements>
    <Hosts>
      <Host xsi:type="MailHost">

        <DesktopFormFactor>
          <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
          <FunctionFile resid="functionFile" />

          <!-- Message Read -->
          <ExtensionPoint xsi:type="MessageReadCommandSurface">
            <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
            <OfficeTab id="TabDefault">
              <!-- Up to 6 Groups added per Tab -->
              <Group id="msgReadGroup">
                <Label resid="groupLabel" />
                <!-- Launch the add-in : task pane button -->
                <Control xsi:type="Button" id="msgReadOpenPaneButton">
                  <Label resid="paneReadButtonLabel" />
                  <Supertip>
                    <Title resid="paneReadSuperTipTitle" />
                    <Description resid="paneReadSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="icon16" />
                    <bt:Image size="32" resid="icon32" />
                    <bt:Image size="80" resid="icon80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="messageReadTaskPaneUrl" />
                  </Action>
                </Control>
                <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
              </Group>
            </OfficeTab>
          </ExtensionPoint>
          <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
        </DesktopFormFactor>
      </Host>
    </Hosts>

    <Resources>
      <bt:Images>
        <bt:Image id="icon16" DefaultValue="~remoteAppUrl/Images/icon16.png"/>
        <bt:Image id="icon32" DefaultValue="~remoteAppUrl/Images/icon32.png"/>
        <bt:Image id="icon80" DefaultValue="~remoteAppUrl/Images/icon80.png"/>
        <bt:Image id="icon128" DefaultValue="~remoteAppUrl/Images/icon128.png"/>
      </bt:Images>
      <bt:Urls>
        <bt:Url id="functionFile" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html"/>
        <bt:Url id="messageReadTaskPaneUrl" DefaultValue="~remoteAppUrl/MessageRead.html"/>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="groupLabel" DefaultValue="Test"/>
        <bt:String id="paneReadButtonLabel" DefaultValue="Test"/>
        <bt:String id="paneReadSuperTipTitle" DefaultValue="Test"/>
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="paneReadSuperTipDescription" DefaultValue="Test"/>
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>

错误的屏幕截图:

enter image description here

2 个答案:

答案 0 :(得分:0)

此错误的最可能原因是超时。在Outlook抛出错误之前,您的加载项有5秒钟的时间来执行Office.initialize方法。

通常,当发生这种情况时,这是因为您没有引用<head>中的office.js库,或者在加载DOM之前不执行Office.initialize。

您可以找到有关引用office.js @ Understanding the JavaScript API for Office

的详细信息

答案 1 :(得分:0)

在您发布的XML清单文件中,有9次出现~remoteAppUrl。如果您还没有这样做,则应将每个AppDomain替换为代表加载项(Web应用程序)文件部署位置的HTTPS URL。

另外,正如上面评论中提到的 @Slava Ivanov - 我相信每个https://www.test.com值应该是包含协议的URI(例如:{{1}})。