1

I have a Word add-in which is trying to use the createDocument() function to create a new document at runtime and then open it. This works fine on Word on the desktop. However, when running in Word online using Google Chrome, a message appears:

"This add-In is about to create a new document in your default folder on your current cloud repository."

But no document is created. In the Chrome developer console, a message appears:

"Sorry, something went wrong. Check the OfficeExtension.Error.debugInfo for more information."

In other browsers, after receiving this prompt another prompt will appear about the add-in opening a new window, after which the document will appear as expected.

As per the documentation, I'm passing the base64-encoded document to the function. The code in question goes like this:

Word.run(async context => {
    var base64doc = fetchBase64(); // gets the base64 encoded document
    const app = context.application; // get the app from the context
    const newDoc = app.createDocument(base64doc);
    newDoc.open();
    await context.sync();
});

So my question is: is this a bug in the OfficeJS library, or with Chrome, or is there something else (something undocumented) that I should be doing to make it work properly in this instance?

Keithius
  • 1,104
  • 2
  • 12
  • 20
  • I tried this API on OneDrive using Chrome and it's working well. On what host are you calling this API, can you try again? – MSFT-Jipyua Nov 15 '19 at 01:44
  • I'm not sure I understand what you mean by "what host" - this is in Word online; Office 365. It says new documents are saved to OneDrive; though the actual hostname of a new document ends with "sharepoint.com." – Keithius Nov 20 '19 at 12:11
  • ok, could you please further try on Chrome the following: don't call the API to create a new document, instead from UI File->New to try whether it succeeds or not. – MSFT-Jipyua Nov 21 '19 at 01:46
  • When I click File > New in the UI it succeeds and opens a new document. – Keithius Nov 25 '19 at 23:07
  • Thanks for providing the information, still not sure why it fails, would you please record a video about the repro steps? – MSFT-Jipyua Nov 27 '19 at 01:53
  • Any way to pass the document name which is opening. Kindly suggest. – S.P Singh Sep 07 '22 at 11:42

1 Answers1

1

@msft-jipyua, I'm just a scrub, but can confirm issue here. Image attached is what I see when I call the auto open function from word online in google chrome. Not sure why it isn't working..sorry for non answer, but this was only way i could add to this post

error message seen javascript console

Craig Charles
  • 11
  • 1
  • 3
  • Thanks, I am calling this API on OneDrive but can't repro this issue. Would you please provide a repro environment or provide the detailed repro steps? such as the code you are using, the Chrome version you are using and the what kind of doc you are creating? – MSFT-Jipyua Nov 28 '19 at 02:02