page_type | languages | products | name | urlFragment | description | extensions | |||||
---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Contact Exporter using Graph Toolkit |
officedev-teamsfx-samples-tab-graph-toolkit-contact-exporter |
Contact Exporter app of Microsoft Teams Tab app. |
|
Graph Toolkit Contact Exporter sample APP provides an easy way to export your teams contact info to Excel file. This APP is using Microsoft Graph Toolkit as UI component.
Note: This sample will only provision single tenant Azure Active Directory app. For multi-tenant support, please refer to this wiki.
- How to use TeamsFx to build frontend hosting on Azure for your tab app.
- How to integration TeamsFx with Microsoft Graph Toolkit library.
- Node.js version 16, 18
- A Microsoft 365 tenant in which you have permission to upload Teams apps. You can get a free Microsoft 365 developer tenant by joining the Microsoft 365 developer program.
- Teams Toolkit Visual Studio Code Extension version 5.0.0 and higher or Teams Toolkit CLI
-
From VSCode
- Clone the repo to your local workspace or directly download the source code.
- Open the project in Visual Studio Code.
- Open Debug View (
Ctrl+Shift+D
) and select "Debug in Teams (Edge)" or "Debug in Teams (Chrome)" in dropdown list. - Press "F5" to open a browser window and then select your package to view contact exporter sample app.
-
From Teams Toolkit CLI
- Run command:
teamsapp provision --env local
. - Run command:
teamsapp deploy --env local
. - Run command:
teamsapp preview --env local
.
- Run command:
If you don't have an Azure subscription, create a free account before you begin
-
From VSCode
- Sign in to Azure by clicking
Sign in to Azure
under theACCOUNTS
section from sidebar. - Click
Provision
fromLIFECYCLE
section or open the command palette and select:Teams: Provision
. - Click
Deploy
or open the command palette and select:Teams: Deploy
.
- Sign in to Azure by clicking
-
From Teams Toolkit CLI
- Run command:
teamsapp auth login azure
. - Run command:
teamsapp provision --env dev
. - Run command:
teamsapp deploy --env dev
.
- Run command:
- From VSCode:
- Once deployment is completed, you can preview the APP running in Azure. In Visual Studio Code, open
Run and Debug
and selectLaunch Remote (Edge)
orLaunch Remote (Chrome)
in the dropdown list and PressF5
or green arrow button to open a browser.
- Once deployment is completed, you can preview the APP running in Azure. In Visual Studio Code, open
- From Teams Toolkit CLI:
- Run command:
teamsapp preview --env dev
.
- Run command:
In some scenarios, it is helpful to skip the login and authentication flow and then provide mocked Graph API responses for development and test purpose. This sample provides a new way to debug it with proxy for mocking Graph API responses. You can customize the desired Graph API responses.
- Refer to Get started with Dev Proxy to install devproxy first.
- Open the project with VS Code, open the
Run and Debug Activity
Panel and selectDebug in Teams with proxy (Edge)
. - Please refer to Proxy Mode for more information.
-
The APP will look like this when it runs for the first time.
-
For the first time to run the app, you need to consent the APP to use Microsoft Graph API and Graph Toolkit. Click on "Accept" button to accept the Authorization.
-
You could try to typing name to select person to view the contact info.
-
You could try to move your mouse to user name to view the personal card of the user.
-
You could try to click 'Export Contact Table to Excel' button to export contact info to Excel.
-
This template has adopted Authorization Code Flow to implement SSO. There's a known limitation with mobile platforms such as iOS and a few Android versions where users have to sign in again as the state was not stored due to third party cookie being blocked by the browser.
-
Due to system webview limitations, users in the tenant with conditional access policies applied cannot consent permissions when conduct an OAuth flow within the Teams mobile clients, it would show error: "xxx requires you to secure this device...".
To achieve full SSO experience, we will recommend you to implement OBO flow to pass your token to a server. See more here.
Date | Author | Comments |
---|---|---|
May 18, 2022 | rentu | update to support Teams Toolkit v4.0.0 |
Mar 17, 2023 | rentu | update to support Teams Toolkit v5.0.0 |
We really appreciate your feedback! If you encounter any issue or error, please report issues to us following the Supporting Guide. Meanwhile you can make recording of your journey with our product, they really make the product better. Thank you!