在Office365中执行OfficeItem.organizer.getAsync时获取权限被拒绝的控制台消息

时间:2019-03-14 11:19:17

标签: office-js outlook-web-addins

在Office 365(版本1803)中本地安装的Outlook(桌面客户端)中。 我们添加了显示在侧面板中的插件。它使用Outlook API从桌面Outlook中获取一些字段信息。它需要从桌面外观中获取有关以下5个字段属性的信息:“主题”,“ itemId”,“组织者”,“ requiredAttendees”,“ optionalAttendees”

为此,我们在约会的撰写模式下使用getAsync API来获取这些值。

示例:

  1. 对于主题,我们会在控制台中得到正确的响应。

    window.Office.context.mailbox.item.subject.getAsync(function(res){console.log(res)});
    
  

输出:{status:"succeeded", value: "appointment1"}

  1. 如果是组织者

    window.Office.context.mailbox.item.organizer.getAsync(function(res){console.log(res)});
    
  

输出:权限被拒绝

请参见附件中的控制台错误消息。

注意: 相同的流程在Internet Explorer浏览器的Outlook Web APP(OWA)中可以正常工作。

我们在从本机Outlook创建和更新流中尝试了上述方案。

有人知道这个问题的原因吗? 我该怎么办才能在本地安装的Outlook客户端中解决此问题?

console screenshot

<?xml version="1.0" encoding="UTF-8"?>
<!--Created:cb85b80c-f585-40ff-8bfc-12ff4d0e34a9-->
<OfficeApp 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"
           xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xsi:type="MailApp">
    <Id>69833250-ebab-4f58-8606-59df2b358121</Id>
    <Version>1.0.0.0</Version>
    <ProviderName>Oracle</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <DisplayName DefaultValue="Engagement Cloud"/>
    <Description DefaultValue="fuscdrmsmc151-fa-ext.us.oracle.com"/>
    <IconUrl DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_80.png"/>
    <HighResolutionIconUrl DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_80.png"/>
    <AppDomains>
        <AppDomain>https://login.microsoftonline.com/</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://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/index.html"/>
                <RequestedHeight>250</RequestedHeight>
            </DesktopSettings>
        </Form>
        <Form xsi:type="ItemEdit">
            <DesktopSettings>
                <SourceLocation DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/index.html?rc_channel=COMPOSE"/>
            </DesktopSettings>
        </Form>
    </FormSettings>
    <Permissions>ReadWriteItem</Permissions>
    <Rule xsi:type="RuleCollection" Mode="Or">
        <Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit"/>
        <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
        <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">
        <Hosts>
            <Host xsi:type="MailHost">
                <DesktopFormFactor>
                    <FunctionFile resid="functionFile"/>
                    <ExtensionPoint xsi:type="MessageReadCommandSurface">
                        <OfficeTab id="TabDefaultRead">
                            <Group id="oscReadGroup">
                                <Label resid="groupLabel"/>
                                <Tooltip resid="groupTooltip"/>

                                <Control xsi:type="Button" id="oscReadButton">
                                    <Label resid="buttonLabel"/>
                                    <Tooltip resid="buttonTooltip"/>
                                    <Supertip>
                                        <Title resid="superTipTitle"/>
                                        <Description resid="superTipDescription"/>
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="osc_icon_16x16"/>
                                        <bt:Image size="32" resid="osc_icon_32x32"/>
                                        <bt:Image size="80" resid="osc_icon_80x80"/>
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="residOscHomeUrl"/>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                    <ExtensionPoint xsi:type="MessageComposeCommandSurface">
                        <OfficeTab id="TabDefaultCompose">
                            <Group id="oscComposeGroup">
                                <Label resid="groupLabel"/>
                                <Tooltip resid="groupTooltip"/>

                                <Control xsi:type="Button" id="oscComposeButton">
                                    <Label resid="buttonLabel"/>
                                    <Tooltip resid="buttonTooltip"/>
                                    <Supertip>
                                        <Title resid="superTipTitle"/>
                                        <Description resid="superTipDescription"/>
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="osc_icon_16x16"/>
                                        <bt:Image size="32" resid="osc_icon_32x32"/>
                                        <bt:Image size="80" resid="osc_icon_80x80"/>
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="residOscHomeEditUrl"/>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                    <ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
                        <OfficeTab id="TabDefaultApptRead">
                            <Group id="oscApptReadGroup">
                                <Label resid="groupLabel"/>
                                <Tooltip resid="groupTooltip"/>

                                <Control xsi:type="Button" id="oscApptReadButton">
                                    <Label resid="buttonLabel"/>
                                    <Tooltip resid="buttonTooltip"/>
                                    <Supertip>
                                        <Title resid="superTipTitle"/>
                                        <Description resid="superTipDescription"/>
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="osc_icon_16x16"/>
                                        <bt:Image size="32" resid="osc_icon_32x32"/>
                                        <bt:Image size="80" resid="osc_icon_80x80"/>
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="residOscHomeUrl"/>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                    <ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
                        <OfficeTab id="TabDefaultApptCompose">
                            <Group id="oscApptComposeGroup">
                                <Label resid="groupLabel"/>
                                <Tooltip resid="groupTooltip"/>
                                <Control xsi:type="Button" id="oscApptComposeButton">
                                    <Label resid="buttonLabel"/>
                                    <Tooltip resid="buttonTooltip"/>
                                    <Supertip>
                                        <Title resid="superTipTitle"/>
                                        <Description resid="superTipDescription"/>
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="osc_icon_16x16"/>
                                        <bt:Image size="32" resid="osc_icon_32x32"/>
                                        <bt:Image size="80" resid="osc_icon_80x80"/>
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="residOscHomeEditUrl"/>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                </DesktopFormFactor>
            </Host>
        </Hosts>
        <Resources>
            <bt:Images>
                <bt:Image id="osc_icon_16x16" DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_16.png"/>
                <bt:Image id="osc_icon_32x32" DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_32.png"/>
                <bt:Image id="osc_icon_80x80" DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_80.png"/>
            </bt:Images>
            <bt:Urls>
                <bt:Url id="residOscHomeUrl" DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/index.html"/>
                <bt:Url id="residOscHomeEditUrl" DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/index.html?rc_channel=COMPOSE"/>
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="groupLabel" DefaultValue="Engagement Cloud"/>
                <bt:String id="buttonLabel" DefaultValue="Engagement Cloud"/>
                <bt:String id="superTipTitle" DefaultValue="fuscdrmsmc151-fa-ext.us.oracle.com"/>
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="groupTooltip" DefaultValue="Oracle Engagement Cloud actions"/>
                <bt:String id="buttonTooltip" DefaultValue="Launches Oracle Engagement Cloud Application"/>
                <bt:String id="superTipDescription" DefaultValue="Launches Oracle Engagement Cloud Application"/>
            </bt:LongStrings>
        </Resources>
        <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1"
                          xsi:type="VersionOverridesV1_1">
            <Hosts>
                <Host xsi:type="MailHost">
                    <DesktopFormFactor>
                        <FunctionFile resid="functionFile"/>
                        <ExtensionPoint xsi:type="MessageReadCommandSurface">
                            <OfficeTab id="TabDefaultRead">
                                <Group id="oscReadGroup">
                                    <Label resid="groupLabel"/>
                                    <Tooltip resid="groupTooltip"/>

                                    <Control xsi:type="Button" id="oscReadButton">
                                        <Label resid="buttonLabel"/>
                                        <Tooltip resid="buttonTooltip"/>
                                        <Supertip>
                                            <Title resid="superTipTitle"/>
                                            <Description resid="superTipDescription"/>
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="osc_icon_16x16"/>
                                            <bt:Image size="32" resid="osc_icon_32x32"/>
                                            <bt:Image size="80" resid="osc_icon_80x80"/>
                                        </Icon>
                                        <Action xsi:type="ShowTaskpane">
                                            <SourceLocation resid="residOscHomeUrl"/>
                                            <SupportsPinning>true</SupportsPinning>
                                        </Action>
                                    </Control>
                                </Group>
                            </OfficeTab>
                        </ExtensionPoint>
                        <ExtensionPoint xsi:type="MessageComposeCommandSurface">
                            <OfficeTab id="TabDefaultCompose">
                                <Group id="oscComposeGroup">
                                    <Label resid="groupLabel"/>
                                    <Tooltip resid="groupTooltip"/>

                                    <Control xsi:type="Button" id="oscComposeButton">
                                        <Label resid="buttonLabel"/>
                                        <Tooltip resid="buttonTooltip"/>
                                        <Supertip>
                                            <Title resid="superTipTitle"/>
                                            <Description resid="superTipDescription"/>
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="osc_icon_16x16"/>
                                            <bt:Image size="32" resid="osc_icon_32x32"/>
                                            <bt:Image size="80" resid="osc_icon_80x80"/>
                                        </Icon>
                                        <Action xsi:type="ShowTaskpane">
                                            <SourceLocation resid="residOscHomeEditUrl"/>
                                            <SupportsPinning>true</SupportsPinning>
                                        </Action>
                                    </Control>
                                </Group>
                            </OfficeTab>
                        </ExtensionPoint>
                        <ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
                            <OfficeTab id="TabDefaultApptRead">
                                <Group id="oscApptReadGroup">
                                    <Label resid="groupLabel"/>
                                    <Tooltip resid="groupTooltip"/>

                                    <Control xsi:type="Button" id="oscApptReadButton">
                                        <Label resid="buttonLabel"/>
                                        <Tooltip resid="buttonTooltip"/>
                                        <Supertip>
                                            <Title resid="superTipTitle"/>
                                            <Description resid="superTipDescription"/>
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="osc_icon_16x16"/>
                                            <bt:Image size="32" resid="osc_icon_32x32"/>
                                            <bt:Image size="80" resid="osc_icon_80x80"/>
                                        </Icon>
                                        <Action xsi:type="ShowTaskpane">
                                            <SourceLocation resid="residOscHomeUrl"/>
                                            <SupportsPinning>true</SupportsPinning>
                                        </Action>
                                    </Control>
                                </Group>
                            </OfficeTab>
                        </ExtensionPoint>
                        <ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
                            <OfficeTab id="TabDefaultApptCompose">
                                <Group id="oscApptComposeGroup">
                                    <Label resid="groupLabel"/>
                                    <Tooltip resid="groupTooltip"/>

                                    <Control xsi:type="Button" id="oscApptComposeButton">
                                        <Label resid="buttonLabel"/>
                                        <Tooltip resid="buttonTooltip"/>
                                        <Supertip>
                                            <Title resid="superTipTitle"/>
                                            <Description resid="superTipDescription"/>
                                        </Supertip>
                                        <Icon>
                                            <bt:Image size="16" resid="osc_icon_16x16"/>
                                            <bt:Image size="32" resid="osc_icon_32x32"/>
                                            <bt:Image size="80" resid="osc_icon_80x80"/>
                                        </Icon>
                                        <Action xsi:type="ShowTaskpane">
                                            <SourceLocation resid="residOscHomeEditUrl"/>
                                            <SupportsPinning>true</SupportsPinning>
                                        </Action>
                                    </Control>
                                </Group>
                            </OfficeTab>
                        </ExtensionPoint>
                    </DesktopFormFactor>
                </Host>
            </Hosts>
            <Resources>
                <bt:Images>
                    <bt:Image id="osc_icon_16x16"
                              DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_16.png"/>
                    <bt:Image id="osc_icon_32x32"
                              DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_32.png"/>
                    <bt:Image id="osc_icon_80x80"
                              DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/css/images/osc_icon_80.png"/>
                </bt:Images>
                <bt:Urls>
                    <bt:Url id="residOscHomeUrl"
                            DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/index.html"/>
                    <bt:Url id="residOscHomeEditUrl"
                            DefaultValue="https://fuscdrmsmc151-fa-ext.us.oracle.com/crmUI/osc365/web/index.html?rc_channel=COMPOSE"/>
                </bt:Urls>
                <bt:ShortStrings>
                    <bt:String id="groupLabel" DefaultValue="Engagement Cloud"/>
                    <bt:String id="buttonLabel" DefaultValue="Engagement Cloud"/>
                    <bt:String id="superTipTitle" DefaultValue="fuscdrmsmc151-fa-ext.us.oracle.com"/>
                </bt:ShortStrings>
                <bt:LongStrings>
                    <bt:String id="groupTooltip" DefaultValue="Oracle Engagement Cloud actions"/>
                    <bt:String id="buttonTooltip" DefaultValue="Launches Oracle Engagement Cloud Application"/>
                    <bt:String id="superTipDescription" DefaultValue="Launches Oracle Engagement Cloud Application"/>
                </bt:LongStrings>
            </Resources>
        </VersionOverrides>
    </VersionOverrides>
</OfficeApp>

2 个答案:

答案 0 :(得分:0)

您在清单中指定了哪些权限?

Outlook加载项在其清单中指定所需的权限级别。可用级别为RestrictedReadItemReadWriteItemReadWriteMailbox。这些权限级别是累积的:Restricted是最低级别,每个较高级别都包括所有较低级别的权限。 ReadWriteMailbox包含所有受支持的权限。

Restricted权限是最基本的权限级别。在清单的Restricted元素中指定Permissions,以请求此权限。如果该加载项在清单中没有请求特定的权限,则默认情况下,Outlook将此权限分配给该邮件加载项。

尝试访问主题或组织者等成员将返回null并导致错误消息,指出Outlook要求邮件加载项具有提升的权限。您必须至少请求ReadItem权限。

答案 1 :(得分:0)

版本1803中未实现Organizer.getAsync API。我建议在调用API之前通过Office.context.requirements.isSetSupported("Mailbox", 1.7)检查设置的要求。这样,您可以在使用API​​之前了解客户端版本是否支持需求集。