Keith
Keith

Reputation: 155872

JS callback in a WebBrowser component in an Outlook VSTO application

We have an Outlook VSTO component that adds a panel that contains a WebBrowser component, which in turn opens a web page.

We want to call back from the web page using WebBrowser.ObjectForScripting, but the guidance provided by MS here doesn't work.

So in the C# VSTO we have something like:

[ComVisible(true), 
 PermissionSet(SecurityAction.Demand, Name="FullTrust")]
public class MyComponent { ...

    webBrowser1.ObjectForScripting = this;
    webBrowser1.Document.InvokeScript("test");

    ...

    public void HandleResult() { ...

And in the JS we have something like:

function test() {
    doSomethingAsync().then(function(result) {  
        window.external.HandleResult();
    });
}

However HandleResult is never called.

I think the issue it due to the PermissionSet being denied permissions in a VSTO add-in that it does get in stand alone Windows Forms apps.

Any idea how to set the appropriate permissions?

Upvotes: 2

Views: 155

Answers (0)

Related Questions