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

标签 javascript outlook-addin office-js

目前正在开发基于 JavaScript 的 Outlook 插件。当加载项启动时,我想在读取和写入模式下打开不同的对话框。

如何检查加载项是否处于消息读取或写入模式?

ma​​nifest.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)。

在您的示例 list 中,这意味着对 messageReadTaskPaneUrlindex-file URL 使用不同的 URL 或查询参数。

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

关于javascript - microsoft office javascript API中messageRead和messageWrite模式的逻辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55100558/

相关文章:

javascript - 从模式对话框中的 ajax 调用中删除缓存的信息

javascript - 如何根据 JavaScript 中的键值正确设置输入?

c# - 插件无法在 Outlook 2010 32 位上捕获日历事件

c# - 如何允许与 Dynamics 服务器的一般连接

office-addins - Office.EventType.DocumentSelectionChanged(在 Excel 中)不适用于所有 Web 浏览器

javascript - 我可以在 javascript 中动态添加属性吗?

javascript - 一个监控html页面的教科书式解决方案

c# - 如何从 Outlook 2010 插件中以编程方式显示对话框(回复/转发/等)

javascript - Excel SelectionChanged 事件未触发

javascript - 当我在我的 Word 插件应用程序中使用 Promise 时出现 Promise 未定义错误