2

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?

6
  • 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? Commented Nov 15, 2019 at 1: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." Commented Nov 20, 2019 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. Commented Nov 21, 2019 at 1:46
  • When I click File > New in the UI it succeeds and opens a new document. Commented Nov 25, 2019 at 23:07
  • Thanks for providing the information, still not sure why it fails, would you please record a video about the repro steps? Commented Nov 27, 2019 at 1:53

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.