Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
page_type description products languages extensions urlFragment
sample
Microsoft Teams tab sample app for demonstrating device permissions
office-teams
office
office-365
nodejs
contentType createdDate
samples
27-07-2021 16:32:33
officedev-microsoft-teams-samples-tab-device-permissions-nodejs

Tab Device Permission Demo

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

Interaction with app - Desktop View

Tab Device PermissionsGif

Interaction with app - Mobile View

Tab Device PermissionsGif Mobile

Prerequisites

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.

Setup

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.

  1. Register a new application in the Azure Active Directory – App Registrations portal.

  2. Setup NGROK

    • Run ngrok - point to port 3000
    ngrok http -host-header=localhost 3000
  3. 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
  1. 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 the manifest.json)
    • Edit the manifest.json for validDomains and replace {{domain-name}} with base Url of your domain. E.g. if you are using ngrok it would be https://1234.ngrok.io then your domain-name will be 1234.ngrok.io.
    • Zip up the contents of the AppPackage folder to create a manifest.zip (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)

Running the sample - Desktop View

Install app:

Install App

Device permission tab:

desktopHome

Tab device permission:

deviceBrowser

Device permission tab:

devicePermBrowser

Running the sample - Mobile View

Tab device permission(Capture Image and Media):

mainTab1

Tab device permission(Scan Barcode):

mainTab2

Tab device permission(People Picker and Get Location):

mainTab3

Device permission tab:

allowPermission

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.

Contributing

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 opencode@microsoft.com with any additional questions or comments.

Further reading