我们有一个 Outlook VSTO 组件,它添加了一个面板,该面板包含一个WebBrowser
组件,该组件又打开一个网页。
我们想从网页中使用 回调WebBrowser.ObjectForScripting
,但是这里 MS 提供的指导不起作用。
所以在 C# VSTO 中我们有类似的东西:
[ComVisible(true),
PermissionSet(SecurityAction.Demand, Name="FullTrust")]
public class MyComponent { ...
webBrowser1.ObjectForScripting = this;
webBrowser1.Document.InvokeScript("test");
...
public void HandleResult() { ...
在 JS 中,我们有类似的东西:
function test() {
doSomethingAsync().then(function(result) {
window.external.HandleResult();
});
}
但是HandleResult
永远不会被调用。
我认为这个问题是由于PermissionSet
VSTO 加载项中的权限被拒绝,它确实进入了独立的 Windows 窗体应用程序。
知道如何设置适当的权限吗?