Reputation: 300
I'm developing a plugin in Teams I use clipboard in this plugin, but when I do Clipboard operation, it gives the following error. There is no clipboard permission in the device permissions section of Teams. how can i solve this problem
Error Message=Uncaught (in promise) DOMException: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes for more details.
Upvotes: 1
Views: 1335
Reputation: 12245
Currently, this permission is not implemented in teams (means: your teams app cannot use the clipboard API). If all you need is to allow user copying some text on the screen to the clipboard, you could go for a workaround to use "old" API, i.e.
<TextField ... onFocus={event => event.target.select()} >
....
document.execCommand('copy');
Related question: Microsoft Teams Tab application can't access clipboard
Upvotes: 2