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

Outlook网页版插件OnNewMessageCompose事件触发404错误排查

Outlook网页版插件调用OnNewMessageCompose事件时404错误排查方案

排查步骤

1. 检查commands.html中的脚本引用路径

  • 确认commands.html里引用launchevent.js的路径是否与实际文件位置匹配。如果webpack打包后该文件直接输出在根目录(而非/launchevent/子目录),需将引用改为<script src="launchevent.js"></script>,而非带子目录的路径。
  • 网页版Outlook对路径大小写敏感,需确保脚本文件名、目录名的大小写与实际文件完全一致(桌面版可能忽略大小写差异)。

2. 验证webpack.config.js的输出配置

  • 检查entry配置是否包含launchevent的入口项,确保webpack会打包生成对应的js文件:
    module.exports = {
      entry: {
        launchevent: './src/launchevent.js', // 确认入口路径正确
        // 其他入口...
      }
    }
    
  • 核对output配置的path和publicPath,确保打包后的launchevent.js输出到localhost:3000/launchevent/目录下:
    output: {
      path: path.resolve(__dirname, 'dist/launchevent'), // 输出目录对应请求路径
      publicPath: '/launchevent/',
      filename: '[name].js'
    }
    
  • 确认devServer的static或contentBase配置包含打包后的文件目录,确保开发服务器能正确托管该文件。

3. 核对Manifest配置的命令指向

  • 检查Manifest中MessageComposeCommandSurface扩展点的SourceLocation是否指向正确的commands.html路径,比如:
    <ExtensionPoint xsi:type="MessageComposeCommandSurface">
      <CustomAction id="GenerateSignatureAction" ...>
        <SourceLocation resid="CommandsUrl"/>
      </CustomAction>
    </ExtensionPoint>
    
  • 验证Resources节点中对应的URL资源是否正确:
    <Resources>
      <bt:Urls>
        <bt:Url id="CommandsUrl" DefaultValue="https://localhost:3000/commands.html"/>
      </bt:Urls>
    </Resources>
    
    确保commands.html能通过该URL正常访问,且页面内的脚本引用路径无错误。

4. 直接验证文件可访问性

  • 在浏览器地址栏直接访问https://localhost:3000/launchevent/launchevent.js,如果无法打开,说明文件未部署到该路径,需调整webpack输出配置或脚本引用路径。

内容的提问来源于stack exchange,提问作者Emili Bellot Pulido

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 06:42:48