Add app to team

Namespace: microsoft.graph

Install an app to the specified team.

Note

Installing an app with resource-specific consent (RSC) permissions isn't supported in an application context. If you install an app with RSC permissions, it will return the error 412 - Precondition Failed with Failed to execute TeamsGraphService backend request IsUserAuthorizedToGrantGroupResourceSpecificPermissionsRequest.Workload Unknown.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) TeamsAppInstallation.ReadWriteSelfForTeam1, TeamsAppInstallation.ReadWriteForTeam1, TeamsAppInstallation.ReadWriteAndConsentSelfForTeam, Group.ReadWrite.All2, Directory.ReadWrite.All2
Delegated (personal Microsoft account) Not supported.
Application TeamsAppInstallation.ReadWriteSelfForTeam.All1, TeamsAppInstallation.ReadWriteForTeam.All1, TeamsAppInstallation.ReadWriteAndConsentForTeam.All, TeamsAppInstallation.ReadWriteAndConsentSelfForTeam.All, Group.ReadWrite.All2, Directory.ReadWrite.All2

Note:
1 These permissions cannot be used to install apps that require consent to resource-specific consent permissions
2 These permissions are supported only for backward compatibility. We recommend that you update your solutions to use an alternative permission and avoid using these permissions going forward.

HTTP request

POST /teams/{team-id}/installedApps

Request headers

Header Value
Authorization Bearer {token}. Required.

Request body

The request body should include the generated app ID of the catalog app. For more information, see teamsApp properties.

The following table lists additional properties that can be included in the request body.

Property Type Description
teamsApp String The ID of the app to add.
consentedPermissionSet teamsAppPermissionSet The set of resource-specific permissions that are being consented to.

Note: The permissions consented to during the installation must match the resource-specific permissions specified in the teamsAppDefinition of the app. To get the application and delegated resource-specific permissions, see Example 7. If only delegated resource-specific permissions are specified in the teamsAppDefinition, permissions can be omitted in the request body.

Response

If successful, this method returns a 200 OK response code. It does not return anything in the response body.

Examples

Request

The following is an example of the request.

POST /teams/87654321-0abc-zqf0-321456789q/installedApps
Content-type: application/json

{
   "teamsApp@odata.bind":"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/12345678-9abc-def0-123456789a"
}

Response

The following is an example of the response.

HTTP/1.1 200 OK

To get the list of resource-specific permissions required by the app, get the app from appCatalog, as shown in Example 7.

Request

POST https://graph.microsoft.com/v1.0/teams/7023576d-9e40-47ca-9cf2-daae6838e785/installedApps
Content-Type: application/json

{
  "teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/7023576d-9e40-47ca-9cf2-daae6838e785",
    "consentedPermissionSet": {
        "resourceSpecificPermissions": [
        {
          "permissionValue": "OnlineMeeting.ReadBasic.Chat",
          "permissionType": "delegated"
        },
        {
          "permissionValue": "ChatMessage.Read.Chat",
          "permissionType": "application"
        }]
      }
}

Response

HTTP/1.1 201 Created

See also