这个问题最好通过示例来说明 . 考虑以下:
在第一个示例中,我的 <Permissions/>
元素紧跟在 <FormSettings/>
块之后:
<?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.0" xsi:type="MailApp">
<Id>464672b2-35a8-44a1-8c06-3ad07ed893a7</Id>
<Version>1.0.0.0</Version>
<ProviderName>Example</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Example A"/>
<Description DefaultValue="This is an example add-in."/>
<IconUrl DefaultValue="https://placehold.it/64x64"/>
<HighResolutionIconUrl DefaultValue="https://placehold.it/64x64"/>
<SupportUrl DefaultValue="https://example.com/"/>
<Hosts>
<Host Name="Mailbox"/>
</Hosts>
<Requirements>
<Sets>
<Set Name="MailBox" MinVersion="1.1"/>
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemEdit">
<DesktopSettings>
<SourceLocation DefaultValue="https://example.com"/>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteMailbox</Permissions>
<Rule xsi:type="RuleCollection" Mode="And">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit"/>
</Rule>
</OfficeApp>
我能够 successfully 将此清单添加到我的Exchange管理中心的组织加载项列表中 .
但是,如果我在清单中移动 <Permissions/>
元素 anywhere else ,则清单在尝试添加时无法通过验证:
<?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.0" xsi:type="MailApp">
<Id>464672b2-35a8-44a1-8c06-3ad07ed893a7</Id>
<Version>1.0.0.0</Version>
<ProviderName>Example</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Example A"/>
<Description DefaultValue="This is an example add-in."/>
<IconUrl DefaultValue="https://placehold.it/64x64"/>
<HighResolutionIconUrl DefaultValue="https://placehold.it/64x64"/>
<SupportUrl DefaultValue="https://example.com/"/>
<Hosts>
<Host Name="Mailbox"/>
</Hosts>
<Requirements>
<Sets>
<Set Name="MailBox" MinVersion="1.1"/>
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemEdit">
<DesktopSettings>
<SourceLocation DefaultValue="https://example.com"/>
</DesktopSettings>
</Form>
</FormSettings>
<Rule xsi:type="RuleCollection" Mode="And">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit"/>
</Rule>
<Permissions>ReadWriteMailbox</Permissions>
</OfficeApp>
尝试将此清单添加到Exchange管理中心的组织加载项列表会产生以下错误:
此应用无法安装 . 清单文件不符合架构定义 . 名称空间“http://schemas.microsoft.com/office/appforoffice/1.1”中的元素“OfficeApp”在名称空间“http://schemas.microsoft.com/office/appforoffice/1.1”中具有无效的子元素“权限” . 预期可能元素的列表:命名空间“http://schemas.microsoft.com/office/appforoffice/1.1”中的“DisableEntityHighlighting”以及命名空间中的“VersionOverrides”http://schemas.microsoft.com/office/mailappversionoverrides '以及命名空间中的任何元素'http://www.w3.org/2000/09/xmldsig#'...
只有通过反复试验才能找到验证失败的根本原因 .
我的问题: Why does ordering matter? Why can the <Permissions/> element not appear anywhere within the same nesting level in the manifest?
上下文
此验证失败发生在托管Exchange(Office 365)中,也是在尝试向请求清单的步骤中向Office应用程序提交加载项时 .
2 回答
模式文件定义的标签的顺序 . 不幸的是,这没有很好的文档,我们正在努力改进这个文档 . 由于我们验证架构的安装方式,因此在为Outlook Web加载项定义清单时,顺序很重要 . 我们意识到这可能很麻烦,特别是因为它没有很好地记录,但我们需要特定订单的主要原因是因为它允许我们快速验证清单内容并提高服务性能 .
感谢您提供有关我们文档的反馈 .
Outlook Web加载项组
模式文件定义的标签的顺序 . 在您的情况下,您已包含在清单http://schemas.microsoft.com/office/appforoffice/1.1架构中 . 尝试在架构
<Permissions/>
元素中查找,您将看到以下定义...元素
<Permissions/>
在<sequence/>
中,这意味着它必须按照此元素的顺序定义,并且它在<FormSettings/>
之后并且无处可去 .