我有一个简单的插件,可以向组成的电子邮件正文添加行,它与Office 365 web版本完美配合,但在outlook桌面或我的live.com和我的hotmail帐户中不起作用,
<DesktopFormFactor>
<ExtensionPoint xsi:type="LaunchEvent">
<LaunchEvents>
<LaunchEvent Type="OnNewMessageCompose" FunctionName="checkSignature" />
</LaunchEvents>
<SourceLocation resid="https://localhost:3000/autorunshared.js" />
</ExtensionPoint>
</DesktopFormFactor>
这里是js
function checkSignature(event: Office.AddinCommands.Event) {
console.log('--------------------checkSignature ',event);
}
SourceLocation
元素的resid
属性值应该是一个ID,而不是完整的URL路径。请看下面的代码片段:
<!-- Event-based activation happens in a lightweight runtime.-->
<Runtimes>
<!--
HTML file including reference to or inline JavaScript event handlers.
This is used by Outlook on the web and Outlook on the new Mac UI preview.
-->
<Runtime resid="WebViewRuntime.Url">
<!--
JavaScript file containing event handlers. This is used by Outlook Desktop.
-->
<Override type="javascript" resid="JSRuntime.Url"/>
</Runtime>
</Runtimes>
....
....
....
<ExtensionPoint xsi:type="LaunchEvent">
<LaunchEvents>
<LaunchEvent Type="OnNewMessageCompose" FunctionName="checkSignature" />
</LaunchEvents>
<SourceLocation resid="WebViewRuntime.Url" />
</ExtensionPoint>
....
....
....
<bt:Urls>
<!-- Entry needed for Outlook on the Web / new Mac UI preview. -->
<bt:Url id="WebViewRuntime.Url" DefaultValue="https://localhost:3000/autorun.html" />
<!-- Entry needed for Outlook Desktop. -->
<bt:Url id="JSRuntime.Url" DefaultValue="https://localhost:3000/autorunshared.js" />
</bt:Urls>
更多信息在这里:https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch
你所看到的行为,当你使用完整的URL作为SourceLocation
的值时,Outlook在网络上的工作方式听起来像是一个潜在的错误。我将把它传递给Outlook Web团队。
Outlook web外接程序仅适用于Exchange帐户。通常,在桌面版Outlook中,插件是按邮箱安装的。
如果您需要在Outlook桌面中使用IMAP或其他非exchange帐户支持多个帐户,您可以考虑创建COM加载项。有关详细信息,请参阅演练:为Outlook创建第一个VSTO插件。