【发布时间】:2017-05-26 05:28:29
【问题描述】:
这个问题最好通过例子来说明。考虑以下几点:
在第一个示例中,我的 <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>
我能够成功将此清单添加到我的 Exchange 管理中心的组织加载项列表中。
但是,如果我将 <Permissions/> 元素移动到清单中其他任何地方,则清单在尝试添加时验证失败:
<?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”以及命名空间“http://schemas.microsoft.com/office/mailappversionoverrides”中的“VersionOverrides”以及命名空间“http://www.w3.org/2000/09/xmldsig#”中的任何元素...
只有通过反复试验,我们才能找到验证失败的根本原因。
我的问题:为什么排序很重要?为什么<Permissions/> 元素不能出现在清单中同一嵌套级别的任何位置?
上下文
此验证失败发生在托管 Exchange (Office 365) 中,以及在请求清单的步骤尝试向 Office 商店提交加载项时。
【问题讨论】:
标签: outlook ms-office office-js office-addins