简体   繁体   English

无法在发送加载项清单时在 Outlook 中添加 AppDomain

[英]Unable to add AppDomains in Outlook on send Add-in manifests

I'm relatively new to developing Outlook add-ins, and am facing a problem developing an on-send add-in.我对开发 Outlook 插件比较陌生,并且在开发 On-send 插件时遇到了问题。

I am trying to do an ajax call from inside my on-send add-in like this:我正在尝试从我的 on-send 加载项中执行 ajax 调用,如下所示:

$.ajax({
    url: "https://XXXXXXX.dev:9999/createMeeting",
    data: JSON.stringify(result),
    contentType: 'application/json',
    type: 'POST',
    dataType: 'json',
    error: function(xhr, status, error) {
        console.log("ERRROR", error)
    }
}).done(function(data) {
    console.log("DONE ", data)
});

My manifest looks like this:我的清单如下所示:

<?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" xsi:type="MailApp">

    <AppDomains>
        <AppDomain>DOMAIN1</AppDomain>
        <AppDomain>DOMAIN2</AppDomain>
    </AppDomains>

    <Id>XXXXXXXX-1a52-42a0-96bf-100d801a4ef7</Id>
    <Version>1.0</Version>
    <ProviderName>Contoso</ProviderName>
    <DefaultLocale>en-us</DefaultLocale>
    <DisplayName DefaultValue="Contoso Subject and CC Checker" />
    <Description DefaultValue="Contoso Subject and CC Checker" />

    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="Mailbox" />
        </Sets>
    </Requirements>



    <FormSettings>
        <Form xsi:type="ItemEdit">
            <DesktopSettings>
                <SourceLocation DefaultValue="https://XXXXXXXX.dev:3001/index.html" />
            </DesktopSettings>
        </Form>
    </FormSettings>

    <Permissions>ReadWriteMailbox</Permissions>

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

    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
        <!-- On Send requires VersionOverridesV1_1 -->
        <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
            <Description resid="residAppDescription" />
            <Requirements>
                <bt:Sets DefaultMinVersion="1.3">
                    <bt:Set Name="Mailbox" />
                </bt:Sets>
            </Requirements>

            <Hosts>
                <Host xsi:type="MailHost">
                    <DesktopFormFactor>
                        <!-- The functionfile and function name to call on message send.  -->
                        <!-- In this particular case the function validateSubjectAndCC will be called within the JavaScript code referenced in residUILessFunctionFileUrl. -->
                        <FunctionFile resid="residUILessFunctionFileUrl" />
                        <ExtensionPoint xsi:type="Events">
                            <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="validateSubjectAndCC" />
                        </ExtensionPoint>
                    </DesktopFormFactor>
                </Host>
            </Hosts>
            <Resources>
                <bt:Urls>
                    <!-- The JavaScript code is hosted on a secure and trusted web server. -->
                    <bt:Url id="residUILessFunctionFileUrl" DefaultValue="https://XXXXXXXX.dev:3001/index.html"></bt:Url>
                </bt:Urls>
            </Resources>
        </VersionOverrides>
    </VersionOverrides>

</OfficeApp>

But I keep getting this error when I try to add the add-in但是当我尝试添加加载项时,我不断收到此错误

This app can't be installed. 
The manifest file doesn't conform to the schema definition. 
The element 'OfficeApp' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1' has invalid child element 'AppDomains' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1'. 
List of possible elements expected: 'Id' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1'... 
The element 'OfficeApp' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1' has invalid child element 'AppDomains' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1'. 
List of possible elements expected: 'Id' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1'.

According to the docs , The AppDomains element must be a child of the OfficeApp element.根据文档AppDomains元素必须是OfficeApp元素的子元素。 Am I doing something wrong??难道我做错了什么?? Thanks in advance!提前致谢!

EDIT: This occurs on Outlook OWA (web) and Windows application.编辑:这发生在 Outlook OWA(网络)和 Windows 应用程序上。 Have not verified on other platforms.尚未在其他平台上验证。

It seems like the problem is caused due to the order in which you are adding the elements in manifest.似乎问题是由于您在清单中添加元素的顺序引起的。 As manifest file follows the schema xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" it expects elements in certain order mentioned here .由于清单文件遵循模式 xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" 它需要此处提到的特定顺序的元素。 If you follow the order of elements mentioned in sample manifest it should work fine.如果您遵循示例清单中提到的元素顺序,它应该可以正常工作。

Updated the links again.再次更新了链接。

Posting an example in case anyone else has the same problem.发布一个例子,以防其他人有同样的问题。

Thanks to Outlook Add-ins Team - MSFT!感谢 Outlook 插件团队 - MSFT!

<?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" xsi:type="MailApp">

    <Id>XXXXXX-1a52-XXXXXX-96bf-XXXXXX</Id>
    <Version>1.0</Version>
    <ProviderName>Contoso</ProviderName>
    <DefaultLocale>en-us</DefaultLocale>
    <DisplayName DefaultValue="Contoso Subject and CC Checker" />
    <Description DefaultValue="Contoso Subject and CC Checker" />

    <AppDomains>
        <AppDomain>https://www.XXXXXX.dev</AppDomain>
        <AppDomain>https://XXXXXX.dev</AppDomain>
    </AppDomains>

    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="Mailbox" />
        </Sets>
    </Requirements>


    <FormSettings>
        <Form xsi:type="ItemEdit">
            <DesktopSettings>
                <SourceLocation DefaultValue="https://XXXXXX.dev:3001/index.html" />
            </DesktopSettings>
        </Form>
    </FormSettings>

    <Permissions>ReadWriteMailbox</Permissions>

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

    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
        <!-- On Send requires VersionOverridesV1_1 -->
        <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
            <Description resid="residAppDescription" />
            <Requirements>
                <bt:Sets DefaultMinVersion="1.3">
                    <bt:Set Name="Mailbox" />
                </bt:Sets>
            </Requirements>


            <Hosts>
                <Host xsi:type="MailHost">
                    <DesktopFormFactor>
                        <!-- The functionfile and function name to call on message send.  -->
                        <!-- In this particular case the function validateSubjectAndCC will be called within the JavaScript code referenced in residUILessFunctionFileUrl. -->
                        <FunctionFile resid="residUILessFunctionFileUrl" />
                        <ExtensionPoint xsi:type="Events">
                            <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="validateSubjectAndCC" />
                        </ExtensionPoint>
                    </DesktopFormFactor>
                </Host>
            </Hosts>
            <Resources>
                <bt:Urls>
                    <!-- The JavaScript code is hosted on a secure and trusted web server. -->
                    <bt:Url id="residUILessFunctionFileUrl" DefaultValue="https://XXXXXX:3001/index.html"></bt:Url>
                </bt:Urls>
            </Resources>
        </VersionOverrides>
    </VersionOverrides>

</OfficeApp>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM