# Microsoft Teams

### Connect to Microsoft Teams

1\. Go to the **Resources** page and click the <img src="/files/luUqNwhjG7IZbheUpaBG" alt="" data-size="line">  button.&#x20;

2\. Select **Microsoft Teams**.

3\. Enter your account credentials and click **Connect**.&#x20;

4\. Choose tables to import and click **Finish Setup**.&#x20;

5\. You will see a  <img src="/files/-MgBo4LSmdK4OS-NqLZy" alt="" data-size="line"> icon next to your resource. It may take a few minutes to several hours depending on the data size and the number of your tables. Once your data is ready, you will receive a notification email.&#x20;

### Supported table <a href="#output-schema" id="output-schema"></a>

* [users](https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-beta\&tabs=http)
* [groups](https://docs.microsoft.com/en-us/graph/teams-list-all-teams?context=graph%2Fapi%2F1.0\&view=graph-rest-1.0)
* [group\_members](https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0\&tabs=http)
* [group\_owners](https://docs.microsoft.com/en-us/graph/api/group-list-owners?view=graph-rest-1.0\&tabs=http)
* [channels](https://docs.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-1.0\&tabs=http)
* [channel\_members](https://docs.microsoft.com/en-us/graph/api/channel-list-members?view=graph-rest-1.0\&tabs=http)
* [channel\_tabs](https://docs.microsoft.com/en-us/graph/api/channel-list-tabs?view=graph-rest-1.0\&tabs=http)
* [conversations](https://docs.microsoft.com/en-us/graph/api/group-list-conversations?view=graph-rest-beta\&tabs=http)
* [conversation\_threads](https://docs.microsoft.com/en-us/graph/api/conversation-list-threads?view=graph-rest-beta\&tabs=http)
* [conversation\_posts](https://docs.microsoft.com/en-us/graph/api/conversationthread-list-posts?view=graph-rest-beta\&tabs=http)
* [team\_drives](https://docs.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-beta\&tabs=http#get-the-document-library-associated-with-a-group)
* [team\_device\_usage\_report](https://docs.microsoft.com/en-us/graph/api/reportroot-getteamsdeviceusageuserdetail?view=graph-rest-1.0)

### Authentication

The Microsoft Graph API uses OAuth for authentication. Microsoft Graph exposes granular permissions that control the access that apps have to resources, like users, groups, and mail. When a user signs in to your app they, or, in some cases, an administrator, are given a chance to consent to these permissions. If the user consents, your app is given access to the resources and APIs that it has requested. For apps that don't take a signed-in user, permissions can be pre-consented to by an administrator when the app is installed.

Microsoft Graph has two types of permissions:

* **Delegated permissions** are used by apps that have a signed-in user present. For these apps, either the user or an administrator consents to the permissions that the app requests, and the app can act as the signed-in user when making calls to Microsoft Graph. Some delegated permissions can be consented by non-administrative users, but some higher-privileged permissions require administrator consent.
* **Application permissions** are used by apps that run without a signed-in user present; for example, apps that run as background services or daemons. Application permissions can only be consented by an administrator.

This source requires **Application permissions**. Follow these [instructions](https://docs.microsoft.com/en-us/graph/auth-v2-service?context=graph%2Fapi%2F1.0\&view=graph-rest-1.0) for creating an app in the Azure portal. This process will produce the `client_id`, `client_secret`, and `tenant_id` needed for the tap configuration file.

1. Login to [Azure Portal](https://portal.azure.com/#home)
2. Click upper-left menu icon and select Azure Active Directory
3. Select App Registrations
4. Click New registration
5. Register an application
   1. Name:
   2. Supported account types: Accounts in this organizational directory only
   3. Register (button)
6. Record the client\_id, tenant\_id, and which will be used by the tap for authentication and API integration.
7. Select Certificates & secrets
8. Provide Description and Expires
   1. Description: tap-microsoft-teams client secret
   2. Expires: 1-year
   3. Add
9. Copy the client secret value, this will be the client\_secret
10. Select API permissions
    1. Click Add a permission
11. Select Microsoft Graph
12. Select Application permissions
13. Select the following permissions:
    1. Users
       * User.Read.All
       * User.ReadWrite.All
       * Directory.Read.All
       * Directory.ReadWrite.All
    2. Groups
       * GroupMember.Read.All
       * Group.Read.All
       * Directory.Read.All
       * Group.ReadWrite.All
       * Directory.ReadWrite.All
    3. Group members
       * GroupMember.Read.All
       * Group.Read.All
       * Directory.Read.All
    4. Group owners
       * Group.Read.All
       * User.Read.All
       * Group.Read.All
       * User.ReadWrite.All
       * Group.Read.All
       * User.Read.All
       * Application.Read.All
    5. Channels
       * ChannelSettings.Read.Group
       * ChannelSettings.ReadWrite.Group
       * Channel.ReadBasic.All
       * ChannelSettings.Read.All
       * ChannelSettings.ReadWrite.All
       * Group.Read.All
       * Group.ReadWrite.All
       * Directory.Read.All
       * Directory.ReadWrite.All
    6. Channel members
       * ChannelMember.Read.All
       * ChannelMember.ReadWrite.All
    7. Channel tabs
       * TeamsTab.Read.Group
       * TeamsTab.ReadWrite.Group
       * TeamsTab.Read.All
       * TeamsTab.ReadWriteForTeam.All
       * TeamsTab.ReadWrite.All
       * Group.Read.All
       * Group.ReadWrite.All
       * Directory.Read.All
       * Directory.ReadWrite.All
    8. Conversations
       * Group.Read.All
       * Group.ReadWrite.All
    9. Conversation threads
       * Group.Read.All
       * Group.ReadWrite.All
    10. Conversation posts
        * Group.Read.All
        * Group.ReadWrite.All
    11. Team drives
        * Files.Read.All
        * Files.ReadWrite.All
        * Sites.Read.All
        * Sites.ReadWrite.All
    12. Team device usage report
        * Reports.Read.All
14. Click Add permissions

Token acquiring implemented by [instantiate](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-app-configuration?tabs=python#instantiate-the-msal-application) the confidential client application with a client secret and [calling](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-acquire-token?tabs=python) AcquireTokenForClient from [Microsoft Authentication Library (MSAL) for Python](https://github.com/AzureAD/microsoft-authentication-library-for-python)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acho.io/acho-studio/resources/import-data/microsoft-teams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
