1
votes

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?

1
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
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
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
When I click File > New in the UI it succeeds and opens a new document. - Keithius
Thanks for providing the information, still not sure why it fails, would you please record a video about the repro steps? - MSFT-Jipyua

1 Answers

1
votes

@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