microsoft office javascript API中messageRead和messageWrite模式的逻辑?

microsoft office javascript API中messageRead和messageWrite模式的逻辑?,javascript,outlook-addin,office-js,Javascript,Outlook Addin,Office Js,目前正在开发基于javascript的outlook加载项。启动外接程序时,我希望以读写模式打开不同的对话框 如何检查外接程序是否处于消息读取或写入模式 manifest.xml <!-- Message Read --> <ExtensionPoint xsi:type="MessageReadCommandSurface"> <!-- Use the default tab of the ExtensionPoint or create your

目前正在开发基于javascript的outlook加载项。启动外接程序时,我希望以读写模式打开不同的对话框

如何检查外接程序是否处于消息读取或写入模式

manifest.xml

<!-- Message Read -->
    <ExtensionPoint xsi:type="MessageReadCommandSurface">
    <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
    <OfficeTab id="TabDefault">
        <!-- Up to 6 Groups added per Tab -->
        <Group id="msgReadGroup">
        <Label resid="groupLabel" />
        <!-- Launch the add-in : task pane button -->
        <Control xsi:type="Button" id="msgReadOpenPaneButton">
            <Label resid="paneReadButtonLabel" />
            <Supertip>
            <Title resid="paneReadSuperTipTitle" />
            <Description resid="paneReadSuperTipDescription" />
            </Supertip>
            <Icon>
            <bt:Image size="16" resid="icon16" />
            <bt:Image size="32" resid="icon32" />
            <bt:Image size="80" resid="icon80" />
            </Icon>
            <Action xsi:type="ShowTaskpane">
            <SourceLocation resid="messageReadTaskPaneUrl" />
            </Action>
        </Control>
        </Group>
    </OfficeTab>
    </ExtensionPoint>


<!-- Message Compose -->
    <ExtensionPoint xsi:type="MessageComposeCommandSurface">
        <OfficeTab id="TabDefault">
            <Group id="msgComposeCmdGroup">
            <Label resid="groupLabel"/>
            <Control xsi:type="Button" id="msgComposeIndex">
                <Label resid="indexLabel"/>
                <Supertip>
                <Title resid="indexTitle"/>
                <Description resid="insertGistDesc"/>
                </Supertip>
                <Icon>
                <bt:Image size="16" resid="icon16"/>
                <bt:Image size="32" resid="icon32"/>
                <bt:Image size="80" resid="icon80"/>
                <bt:Image size="80" resid="paksign"/>

                </Icon>
                <Action xsi:type="ShowTaskpane">
                <SourceLocation resid="index-file" />
                </Action>
            </Control>
            </Group>
        </OfficeTab>
    </ExtensionPoint>

我们建议使用不同的SourceLocation URL,或向URL添加查询参数,以区分不同的模式(即
…index.html?mode=MessageRead

在您的示例清单中,这意味着对
messageReadTaskPaneUrl
索引文件
URL使用不同的URL或查询参数

虽然可以检查是否定义了API来尝试确定模式,但我们不建议这样做,因为将来可能会添加API。例如,
Office.context.mailbox.item.from
最初仅在API需求集1.0的读取模式下定义(而
在撰写模式下未定义)。但当在中将
Office.context.mailbox.item.from.getAsync
添加到撰写模式时,这种情况发生了变化