You can enrich your Teams app with native device capabilities, such as camera, microphone, and location. This document guides you on how to request user consent and access the native device permissions.
Note
To integrate media capabilities within your Teams web client, desktop, and mobile, see Integrate media capabilities.
You must request the device permissions to access native device capabilities. The device permissions work similarly for all app constructs, such as tabs, dialogs (referred as task modules in TeamsJS v1.x), or message extensions. The user must go to the permissions page in Teams settings to manage device permissions.
By accessing the device capabilities, you can build richer experiences on the Teams platform, such as:
Capture and view images
Scan QR or barcode
Record and share short videos
Record audio memos and save them for later use
Use the location information of the user to display relevant information
While access to these features is standard in modern web browsers, you must inform Teams about the features you use by updating your app manifest. This update allows you to ask for permissions while your app runs on the Teams desktop.
Manage permissions
A user can manage device permissions in Teams settings by selecting Allow or Deny permissions to specific apps.
Leverage appropriate HTML5 or Teams API to display a prompt for getting consent to access device permissions.
Important
Support for camera, gallery, and microphone is enabled through selectMedia API. Use captureImage API for a single image capture.
Support for location is enabled through getLocation API. You must use this getLocation API for location, as HTML5 geolocation API isn't fully supported on the Teams desktop client.
For example:
To prompt the user to access their location, you must call getCurrentPosition():
Device permissions are stored for every sign in session. It means that if you sign in to another instance of Teams, for example, on another computer, your device permissions from your previous sessions aren't available. Therefore, you must reconsent to device permissions for the new session. It also means, if you sign out of Teams or switch tenants in Teams, your device permissions are deleted from the previous sign in session.
Note
When you consent to the native device permissions, it is valid only for your current login session.
Code sample
Sample name
Description
Node.js
Manifest
Device permissions
The sample shows how to use the device permissions using TeamsJS SDK and browser api's.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Platform Docs feedback
Platform Docs is an open source project. Select a link to provide feedback:
Teams devices provide a familiar experience and are essential for a hybrid workspace. Learn how to provision and manage devices, and associated device accounts.