首页 > 解决方案 > Error: Could not complete the operation due to error 8150002e

问题描述

I am working on a Outlook VSTO add-in, in which I am using 'System.Windows.Forms.WebBrowser' to display the add-in functionality.

One functional requirement is to have oauth connection to cloud accounts (like OneDrive, Dropbox). When user clicks a button (e.g. 'Connect OneDrive'), we call 'window.open' in JavaScript code (ES6) with the oauth-url.

The issue which I am facing is, if user doesn't enter any credentials and close the window, and then again try to connect the cloud account (by clicking the 'Connect OneDrive'), I am getting an exception (Error: Could not complete the operation due to error 8150002e.).

I couldn't find any information about the error code '8150002e' on web.

This exception is not always present but comes around 50% of the times.

Any help would be appreciated in this.

what I have tried:

  1. changing the windowName param every time window.open is called

  2. having global var for window Object.

  3. Using _blank parameter to open a new window every time.

  4. After 5-6 times, the error comes up, after 5-6 times error goes away and auth window start coming up like before.

  5. Opening a simple static HTML page in 'window.open' to verify if the issue has something to do with HTML page. The above issue is still present.
  6. Resetting the System.Windows.Forms.WebBrowser programmatically.
  7. Removing the cookies.
  8. Instead of calling window.open from JavaScript code, we call VSTO code to open the browser window, the error is still there.

Edit: Created a minimal viable example at https://github.com/vinay-x/SampleAddin

Code related to the issue:

The sample application has a windows form which contains a webBrowser control, which navigates to a simple HTML page which contains a button.

标签: javascriptc#vstooutlook-addinwindow.open

解决方案


不得不处理一些 IE11 的东西,我遇到了这个问题。我发现解决此问题的解决方案是在调用 window.open 之前将 window 变量设置为 null。

所以对于你的例子,你有这个:

function myFunction() {
    window.open("https://www.w3schools.com", 'BackfliptOAuth', "width=800,height=800,center=true,useContentSize=true");
}

我将其修改为:

var win = null;
function myFunction() {
    win = null;
    win = window.open("https://www.w3schools.com", 'BackfliptOAuth', "width=800,height=800,center=true,useContentSize=true");
}

推荐阅读