page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
Microsoft Teams tab sample app for demonstrating device permissions (audio, video, location). |
|
|
|
officedev-microsoft-teams-samples-tab-device-permissions-nodejs |
This sample shows tab device permissions.
It also shows Device permissions for the browser. Please refer Device permissions for browser for more information.
The latest update on how device permissions are handled in the browser is currently available in public developer preview
only.
This update will be generally available (GA) by February 01, 2022
Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your teams and/or as a personal app. (Sideloading must be enabled for your tenant, see steps here).
Tab Device Permission: Manifest
To test locally, NodeJS must be installed on your development machine (version 16.14.2 or higher).
```bash
# determine node version
node --version
```
-
To test locally, you'll need Ngrok installed on your development machine. Make sure you've downloaded and installed Ngrok on your local machine. ngrok will tunnel requests from the Internet to your local computer and terminate the SSL connection from Teams.
-
M365 developer account or access to a Teams account with the appropriate permissions to install an app.
NOTE: The free ngrok plan will generate a new URL every time you run it, which requires you to update your Azure AD registration, the Teams app manifest, and the project configuration. A paid account with a permanent ngrok URL is recommended.
-
Register a new application in the Azure Active Directory – App Registrations portal.
-
Setup NGROK
- Run ngrok - point to port
3000
ngrok http -host-header=localhost 3000
- Run ngrok - point to port
-
Setup for code
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
In a terminal, navigate to
samples/tab-device-permissions/nodejs
-
Install modules
npm install
-
Start the bot
npm start
- Setup Manifest for Teams
- This step is specific to Teams.
- Edit the
manifest.json
contained in the ./AppPackage folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) everywhere you see the place holder string{{Microsoft-App-Id}}
(depending on the scenario the Microsoft App Id may occur multiple times in themanifest.json
) - Edit the
manifest.json
forvalidDomains
and replace{{domain-name}}
with base Url of your domain. E.g. if you are using ngrok it would behttps://1234.ngrok.io
then your domain-name will be1234.ngrok.io
. - Zip up the contents of the
AppPackage
folder to create amanifest.zip
(Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- Edit the
Install app:
Device permission tab:
Tab device permission:
Device permission tab:
Tab device permission(Capture Image and Media):
Tab device permission(Scan Barcode):
Tab device permission(People Picker and Get Location):
Device permission tab:
Similary, you can try out for other features.
Important
Please take a look at notes section in Device Permissions documentation as not all devices support these permissions.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.