You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Outlook Web加载项:ExecutionFunction未执行loadPage函数的配置问题

问题排查与解决方案

可能的配置问题及修复步骤

1. 检查functionFile在清单中的位置是否正确

bt:Url id="functionFile"必须放置在清单的<Resources>节点下,不能直接嵌套在CommandSurface区域内。正确的结构示例:

<Resources>
  <bt:Urls>
    <bt:Url id="functionFile" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html" />
    <!-- 其他URL配置项 -->
  </bt:Urls>
  <!-- 其他资源配置 -->
</Resources>

2. 确认FunctionFile.html已正确引入脚本文件

在FunctionFile.html中,必须通过<script>标签正确引入FunctionFile.js,路径要与实际文件位置匹配:

<!DOCTYPE html>
<html>
<head>
    <script src="../Scripts/FunctionFile.js"></script>
</head>
<body>
    <!-- 该页面无需可见内容,仅作为函数执行的载体 -->
</body>
</html>

3. 确保函数处于全局作用域

Outlook只能调用全局作用域下的函数,需将loadPage挂载到window对象上,修改FunctionFile.js:

window.loadPage = function(event) {
    alert("Venkat Show Add-In");
    // 在此添加独立窗口打开逻辑
    window.open('你的目标网页地址');
    event.completed();
}

注:原代码中的event = null属于冗余操作,event.completed()已完成函数执行的回调流程。

4. 验证CommandButton配置完整性

确保你的CommandButton具备完整的标识、标签等配置,示例:

<Control xsi:type="Button" id="MsgReadOpenPageButton">
  <Label resid="OpenPageButtonLabel" />
  <Supertip>
    <Title resid="OpenPageButtonTitle" />
    <Description resid="OpenPageButtonDesc" />
  </Supertip>
  <Icon>
    <bt:Image size="16" resid="Icon16" />
    <bt:Image size="32" resid="Icon32" />
    <bt:Image size="80" resid="Icon80" />
  </Icon>
  <Action xsi:type="ExecuteFunction">
    <FunctionName>loadPage</FunctionName>
  </Action>
</Control>

5. 检查加载项的部署与调试信息

  • 测试加载项需通过Outlook Web的「上传自定义加载项」功能正确部署,可使用Office加载项清单验证工具排查语法错误
  • 打开浏览器开发者工具(F12),切换到Console标签页,查看是否存在脚本加载失败(如404错误)或执行报错信息

内容的提问来源于stack exchange,提问作者Venkata Rao Borra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 04:53:10