OfficeDev / office-js-docs-reference

Microsoft Office JavaScript API Reference
https://learn.microsoft.com/javascript/api/overview
MIT License
105 stars 63 forks source link

typeerror: cannot read properties of undefined (reading 'microphone') #1981

Closed YesLetsGo closed 6 days ago

YesLetsGo commented 6 days ago

Everything works fine, while using office.js by this:

But when I install "office-js" locally via the NPM package by following command (https://github.com/OfficeDev/office-js): npm install @microsoft/office-js --save

And using my office.js like this:

I get typeerror: cannot read properties of undefined (reading 'microphone').

After commenting out the code responsible for reading microphone permissions, the plugin and all its functions work properly. Why is this happening?

AlexJerabek commented 6 days ago

Hi @YesLetsGo,

The most recent version of office-js is available on the CDN. Since the DevicePermission requirement set was recently added, it's likely that update has not yet propagated to the NPM package. This is one of the reasons we recommend always using the CDN version in your project.

The NPM version should catch up soon. Regardless, the current guidance is that Office Add-ins should always reference the library stored in our CDN. I'll tag @gergzk for awareness of this matter.

I'm going to close this issue, since there's nothing actionable to be done in the documentation. Please let me know if you need further assistance.