简体   繁体   English

调试 Outlook 外接桌面

[英]Debugging Outlook Add-in Desktop

I'm currently developing an Add-in using yeoman and generator-office for Outlook to save an email and its attachments to another service.我目前正在使用 yeoman 和 generator-office 为 Outlook 开发一个插件,以将 email 及其附件保存到另一个服务。

Outlook Version: MS Office Professional Plus 2016 v.16.0.48.49.1000 Outlook 版本:MS Office Professional Plus 2016 v.16.0.48.49.1000

I am able to sideload the add-in by going to File->Manage Add-ins->(Outlook webapp extensions page opens)->Add from file->Select my manifest.xml.我可以通过转到文件->管理加载项->(打开 Outlook webapp 扩展页面)->从文件添加->选择我的 manifest.xml 来旁加载加载项。

Then I run npm run start and I get:然后我运行npm run start ,我得到:

App type: desktop
Enabled debugging for add-in 17717569-bd61-4c6a-b99d-ca55924a2916. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
The dev server is running on port 3000. Process id: 9660
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Sideload is not supported.

The add-in is sideloaded and I'm able to use it, but without being able to attach a debugger I'm blocked.加载项是旁加载的,我可以使用它,但无法附加调试器,我被阻止了。

Any known solutions for this?任何已知的解决方案?

Edit: I followed the guide from https://docs.microsoft.com/en-us/outlook/add-ins/quick-start .编辑:我遵循https://docs.microsoft.com/en-us/outlook/add-ins/quick-start的指南。

@MS Team If it is not possible to add a debugger using Yeoman, is it possible using the Visual Studio approach? @MS Team 如果无法使用 Yeoman 添加调试器,是否可以使用 Visual Studio 方法?

You can run the dev server ( npm run dev-server ) rather than use npm start because Outlook does not support sideloading.您可以运行开发服务器( npm run dev-server )而不是使用npm start ,因为 Outlook 不支持侧载。 Once the dev server is running, you can load the add-in using the steps you mentioned.开发服务器运行后,您可以使用您提到的步骤加载加载项。 Once the add-in is running in Outlook, you can use the browser dev tools to debug it.加载项在 Outlook 中运行后,您可以使用浏览器开发工具对其进行调试。

If you are on Windows 10 Version 1903 or later, it should be using the Edge WebView, and you can use the Edge DevTools Preview from the Windows 10 Store to debug it.如果您使用的是 Windows 10 版本 1903 或更高版本,则应使用 Edge WebView,您可以使用 Windows 10 中的 Edge DevTools Preview 对其进行调试。 For previous version of Windows, where the Internet Explorer WebView is being used, the F12 dev tools are used to debug.对于之前版本的 Windows,使用的是 Internet Explorer WebView,使用F12开发工具进行调试。

For Visual Studio Code and Windows 10 Version 1903 or higher there is an option to debug using Microsoft Office Add-in Debugger Extension .对于 Visual Studio Code 和 Windows 10 版本 1903 或更高版本,可以选择使用Microsoft Office Add-in Debugger Extension 进行调试

To install it:要安装它:

  1. In VSC -> Extensions -> Search for Microsoft Office Add-in Debugger Extension and install it在 VSC -> Extensions -> 搜索 Microsoft Office Add-in Debugger Extension 并安装它
  2. In the .vscode/launch.json add the following code to the configurations section:.vscode/launch.json中,将以下代码添加到配置部分:
{
  "type": "office-addin",
  "request": "attach",
  "name": "Attach to Office Add-ins",
  "port": 9222,
  "trace": "verbose",
  "url": "https://localhost:3000/taskpane.html?_host_Info=HOST$Win32$16.01$en-US$$$$0",
  "webRoot": "${workspaceFolder}",
  "timeout": 45000
}
  1. In the section of JSON you just copied, find the "url" section.在您刚刚复制的 JSON 部分中,找到“url”部分。 In this URL, you will need to replace the uppercase HOST text with the application that is hosting your Office add-in.在此 URL 中,您需要将大写的 HOST 文本替换为托管 Office 加载项的应用程序。 For example, if your Office add-in is for Excel, your URL value would be "https://localhost:3000/taskpane.html?_host_Info=Excel$Win32$16.01$en-US$$$$0". For example, if your Office add-in is for Excel, your URL value would be "https://localhost:3000/taskpane.html?_host_Info=Excel$Win32$16.01$en-US$$$$0".

Source: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/debug-with-vs-extension来源: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/debug-with-vs-extension

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM