仅限命令加载项的 Office 365 清单

问题描述

我有一个仅包含两个 ExecuteFunction 命令的加载项。在 Visual Studio 生成的清单文件中,它包含如下 xml:

<FormSettings>
    <Form xsi:type="ItemRead">
        <DesktopSettings>
            <SourceLocation DefaultValue="https://localhost:44351/MessageRead.html"/>
            <!--If you opt to include RequestedHeight,it must be between 32px to 450px,inclusive.-->
            <RequestedHeight>250</RequestedHeight>
        </DesktopSettings>
    </Form>
</FormSettings>

因为我在任务窗格中没有任何 UI,为什么它需要这个 xml,以及这里对于我的纯命令加载项的最佳实践是什么。谢谢。

解决方法

此 XML 的存在是为了与旧版 Outlook 客户端兼容,并且是清单架构所必需的。

作为最佳做法,由于您的加载项仅使用加载项命令,请将清单中的 minimum requirement set 设置为至少 1.3,这样清单和此 URL 将不会被使用由不支持加载项命令的客户端提供。

<Requirements>
  <Sets>
    <Set Name="Mailbox" MinVersion="1.3" />
  </Sets>
</Requirements>

从技术上讲,此 SourceLocation URL 仍会出现在 identity token 的负载中,因此我建议将其设置为加载项独有的 URL。