OfficeDev / office-js-helpers

[ARCHIVED] A collection of helpers to simplify development of Office Add-ins & Microsoft Teams Tabs
MIT License
126 stars 57 forks source link

Office helpers gives undefined exception on Word 2016 #124

Open alirezastack opened 5 years ago

alirezastack commented 5 years ago

When login button is clicked on add-in page I run the sample code given on README it works on office online as expected but the below problem happens when I run add-in on Word 2016 build 16.0.4300.1000:

TypeError: Unable to get property 'displayDialogAsync' of undefined or null reference

Why is this happening and how should I fix this? @Zlatkovsky @casieber

alirezastack commented 5 years ago

Isn't there anyone who could solve this issue? Or give some help?

Zlatkovsky commented 5 years ago

@alirezastack , see my response on https://github.com/OfficeDev/office-js/issues/374. If it solves the issue for you, please go ahead and close the bug.

alirezastack commented 5 years ago

@Zlatkovsky thank you for the link. I check requirements and display the login with Google button when requirements are meet. But it has shaky behaviours. In Mac Word 2016 it shows the login button but Login with Google gives the below error:

Parameter not allowed for this message type: action

It seems that OfficeJsHelpers sends an invalid parameter in opened modal for Google authentication.

The code is as below:

if (Office.context.requirements.isSetSupported('DialogApi' , 1.1)) {
    $('#login_3rd_party_wrapper').show();
} else {
    $('#login_3rd_party_wrapper').hide();
}

I can see the login button on Office Online and it is hidden on Word 2016, but this does not work on Word 2013 and in Mac Word 2016 it sends an invalid parameter.