編輯

共用方式為


Use the Microsoft Graph API to work with Microsoft Teams

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Microsoft Teams is a chat-based workspace in Microsoft 365 that provides built-in access to team-specific calendars, files, OneNote notes, Planner plans, Shifts schedules, and more. You can use the Microsoft Graph API to integrate with Microsoft Teams features.

Common use cases

The following table lists common use cases for Microsoft Teams APIs in Microsoft Graph.

Use cases REST resources See also
Create and manage teams, groups, and channels team, channel, group create team, list teams, create a channel
Add tabs, manage, or install apps in the Microsoft Teams app catalog teamsTab, teamsAppInstallation create teamsTab, list teamsTab, list installedApps
Create channels and chats to send and receive chat messages channel, chat, chatMessage create channel, list channel, send chatMessage in a channel
Use tags to classify users or groups based on common attributes within a team teamworkTag, teamworkTagMember list teamworkTag, create teamworkTag
Create and receive calls, call records or retrieve meeting coordinates call, callRecords answer, invite participants
Connect bots to calls and implement interactive voice response (IVR) call IVR scenarios
Create and retrieve online meetings or check users presence and activity onlineMeeting, presence create onlineMeeting, meetingAttendanceReport
Create and manage workforce integration with shifts, schedules, time cards, or time off in your organization workforceIntegration, schedule, shift, timeOff, timeOffReason create workforceIntegration, create schedule, create shift, create timeOff
Use the employee learning API to integrate with Viva Learning employee learning, learningProvider, learningContent list learningProviders, list learningContents

IVR scenarios

The following are the Interactive Voice Response (IVR) scenarios that the calling APIs in Microsoft Graph support:

  • Play an audio prompt - for example, when a call is placed in a customer service agent's queue.
  • Record a response - for example, to record the caller's audio, usually after they heard a prompt with options.
  • Subscribe to tones - for example, when you want to know what DTMF tones the caller selected, usually after hearing the audio prompt.
  • Cancel media processing - for example, when you want to cancel any playPrompt or recordResponse operations that might be in process.

Microsoft Teams limits

The tested performance and capacity limits of Microsoft Teams are documented in Limits and specifications for Microsoft Teams. These limits apply whether using Microsoft Teams directly or using Microsoft Graph APIs. Because every team has a corresponding group, and every group is a directory object, limits on the number of groups and the number of directory objects ("resources") can also come into play.

Files inside channels are stored in SharePoint; SharePoint online limits apply.

See also throttling limits for Microsoft Teams services.

Teams and groups

In Microsoft Graph, Microsoft Teams is represented by a group resource. Both Microsoft Teams and Microsoft 365 groups address the various needs of group collaboration. Almost all the group-based features apply to Microsoft Teams and Microsoft 365 groups, such as group calendar, files, notes, photo, plans, and so on. The main difference between a team and a Microsoft 365 group is the mode of communication between members. Team members communicate by persistent chat in the context of a specific team. Microsoft 365 group members communicate by group conversations, which are email conversations that occur in the context of a group in Outlook.

Any group that has a team has a resourceProvisioningOptions property that contains "Team".

Note: The Group.resourceProvisioningOptions property can be changed. Do not add or remove "Team" from that collection; otherwise, you'll get incorrect results when you list all teams.

The following are the differences at the API level between teams and groups:

Membership changes in Microsoft Teams

Use case Verb URL
Add member POST /teams/{team-id}/members
Remove member DELETE /teams/{team-id}/members/{membership-id}
Update member's role PATCH /teams/{team-id}/members/{membership-id}
Update team PATCH /teams/{team-id}

Polling requirements

If your app polls to see whether a resource has changed, you can only do that once per day. (teamsAsyncOperation is an exception in that it's intended to be polled frequently.) If you need to hear about changes more frequently than that, you should create a subscription to that resource and receive change notifications (webhooks). If you don't find support for the type of subscription you need, we encourage you to provide feedback via the Microsoft 365 Developer Platform ideas forum.

When polling for new messages, you must specify a date range where supported. For more information, see get delta chat messages for a user.

Polling is doing a GET operation on a resource over and over again to see if that resource has changed. You're allowed to GET the same resource multiple times a day, as long as it's not polling. For example, it's okay to GET /me/joinedTeams every time the user visits/refreshes your web page, but it isn't okay to GET /me/joinedTeams in a loop every 30 seconds to refresh that web page.

Apps that don't follow these polling requirements will be considered in violation of the Microsoft APIs Terms of Use. This may result in additional throttling or the suspension or termination of your use of the Microsoft APIs.