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
相关产品推荐
相关产品推荐

