Office365 OfficeJS清单类型MailApp-无法使用WebApplicationInfo

Office365 OfficeJS清单类型MailApp-无法使用WebApplicationInfo,office365,office-js,office-addins,Office365,Office Js,Office Addins,我已经按照规定的步骤进行了操作。应用程序已经注册,我已经获得了要在WebApplicationInfo中使用的guid,以获取OAuth令牌。不幸的是,使用office加载项清单验证器(npm-i-g validate office加载项)我得到了错误 XML架构冲突:您的清单不符合当前集 Office外接程序清单的XML架构定义。(链接: ) -详细信息:命名空间“”中的元素“OfficeApp”无效 命名空间中的子元素“VersionOverrides” ''. 可能元素的列表应为命名空间中

我已经按照规定的步骤进行了操作。应用程序已经注册,我已经获得了要在WebApplicationInfo中使用的guid,以获取OAuth令牌。不幸的是,使用office加载项清单验证器(npm-i-g validate office加载项)我得到了错误

XML架构冲突:您的清单不符合当前集 Office外接程序清单的XML架构定义。(链接: ) -详细信息:命名空间“”中的元素“OfficeApp”无效 命名空间中的子元素“VersionOverrides” ''. 可能元素的列表应为命名空间中的“VersionOverrides” ”“还有 作为命名空间“”中的任何元素

Manifest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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.1"
          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>c64ded7d-29e6-4083-8afa-351c7a630668</Id>

  <!--Version. Updates from the store only get triggered if there is a version change. -->
  <Version>1.0.0.0</Version>
  <ProviderName>An Tran</ProviderName>
  <DefaultLocale>en-US</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="MyMeetings" />
  <Description DefaultValue="Find a room"/>

  <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
  <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" /> 
  <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>
  <SupportUrl DefaultValue="https://contoso.com/support " />

  <!-- 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>AppDomain1</AppDomain>
    <AppDomain>AppDomain2</AppDomain>
    <AppDomain>AppDomain3</AppDomain>
  </AppDomains>

  <Hosts>
    <Host Name="Mailbox" />
  </Hosts>
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1" />
    </Sets>
  </Requirements>
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://localhost:3000/index.html"/>
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
     <Form xsi:type="ItemEdit">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://localhost:3000/index.html"/>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteItem</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" />
  </Rule>
  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
  <!-- <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1"> -->

    <Hosts>
      <Host xsi:type="MailHost">

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

            <ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
              <OfficeTab id="TabDefault">
                  <Group id="apptComposeDemoGroup">
                      <Label resid="groupLabel" />
                      <!-- Function (UI-less) button -->
                      <Control xsi:type="Button" id="apptComposeFunctionButton">
                          <Label resid="funcComposeButtonLabel" />
                          <Supertip>
                              <Title resid="funcComposeSuperTipTitle" />
                              <Description resid="funcComposeSuperTipDescription" />
                          </Supertip>
                          <Icon>
                              <bt:Image size="16" resid="icon16" />
                              <bt:Image size="32" resid="icon32" />
                              <bt:Image size="80" resid="icon80" />
                          </Icon>
                          <Action xsi:type="ExecuteFunction">
                            <FunctionName>run</FunctionName>
                          </Action>
                      </Control>             
                  </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="https://localhost:3000/assets/icon-16.png"/>
        <bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
        <bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
      </bt:Images>
      <bt:Urls>
        <bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
        <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="groupLabel" DefaultValue="MyMeetings Group"/>
        <bt:String id="customTabLabel"  DefaultValue="My Add-in Tab"/>
        <bt:String id="funcComposeSuperTipTitle" DefaultValue="Find a room!"/>
        <bt:String id="funcComposeButtonLabel" DefaultValue="MyMeetings!"/>
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="funcComposeSuperTipDescription" DefaultValue="Find a most suitable room with MyMeetings."/>
      </bt:LongStrings>
    </Resources>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
    <WebApplicationInfo>
      <Id>c64ded7d-29e6-4083-8afa-351c7a630668</Id>
      <Resource>api://localhost:3000/c64ded7d-29e6-4083-8afa-351c7a630668</Resource>
      <Scopes>
        <Scope>files.read.all</Scope>
        <Scope>profile</Scope>   
      </Scopes>
    </WebApplicationInfo>
    </VersionOverrides>
  </VersionOverrides>

</OfficeApp>

我对Office加载项中的SSO不太熟悉,但以下文档包含的信息可能有助于您解决所描述的问题:

特别是,我注意到文档中的以下信息可能有助于解决您描述的问题:

  • ,则
    WebApplicationInfo
    元素应出现在
    部分的末尾。(您发布的代码包含在
    部分的末尾。)
  • WebApplicationInfo
    元素中,在
    ID
    元素或
    Resource
    元素中的ID值周围不应该有大括号({})。(您发布的代码在两个位置的ID值周围都包含大括号。)包含
    WebApplicationInfo
    元素的示例
  • 当您使用注释掉的
    WebApplicationInfo
    元素调用
    getAccessTokenAsync
    时,您会收到一个错误(
    13000-不支持标识API

更新(根据Marc LaFleur提供的其他信息):


根据Marc在下面评论中链接到的中的信息,您可以尝试将v1.1的
VersionOverrides
元素(其中包括
WebApplicationInfo
元素)嵌套在v1.0的
VersionOverrides
元素中,如文档所述

+1感谢您在研究上付出的努力和时间。感谢您的花括号。但是,当我使用较新版本的
VersionOverrides
时,仍然会出现错误(请参见编辑的问题),因此我仍然无法安装我的加载项,也无法获得OAuth令牌。您是否确认使用了支持SSO的足够新的Office版本?文档指定了SSO所需的Office版本。还值得注意的是,
VersionOverrides
有点用词不当。它并不是真正覆盖值,因为它不会“退回”到先前的定义。换句话说,如果您没有在
VersionOverridesV1\u 1
中声明某些内容,它将不会返回到
VersionOverridesV1\u 0
中的声明,因为。好信息,谢谢,马克!(我已经更新了答案,以包含此信息,以便本帖的未来读者更容易发现。)我建议您针对新问题提出新问题(运行函数不执行),而不是继续更改此帖子/问题。这样做会使这些信息(Q&A)在将来对其他人更有用。
 Office.context.auth.getAccessTokenAsync(function(result) {
   if (result.status === "succeeded") {
     var token = result.value.accessToken;
   } else {
     console.log("Error obtaining token", result.error);
   }
 });