Upravit

Sdílet prostřednictvím


Install app for user

Namespace: microsoft.graph

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.

Install an app in the personal scope of the specified user.

Note: This API works differently in one or more national clouds. For details, see Microsoft Teams API implementation differences in national clouds.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) TeamsAppInstallation.ReadWriteSelfForUser TeamsAppInstallation.ManageSelectedForUser, TeamsAppInstallation.ReadWriteAndConsentForUser, TeamsAppInstallation.ReadWriteAndConsentSelfForUser, TeamsAppInstallation.ReadWriteForUser, TeamsAppInstallation.ReadWriteSelectedForUser
Delegated (personal Microsoft account) Not supported. Not supported.
Application TeamsAppInstallation.ReadWriteSelfForUser.All TeamsAppInstallation.ManageSelectedForUser.All, TeamsAppInstallation.ReadWriteAndConsentForUser.All, TeamsAppInstallation.ReadWriteAndConsentSelfForUser.All, TeamsAppInstallation.ReadWriteForUser.All, TeamsAppInstallation.ReadWriteSelectedForUser.All

Note

If you want your app to install, get, upgrade, or remove an app for the user, you must use the TeamsAppInstallation.ReadWriteForUser permission.

HTTP request

POST /users/{user-id | user-principal-name}/teamwork/installedApps

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

The request body should contain the catalog generated app ID for the app catalog. For details, see teamsApp properties. The following table lists additional parameters that can be used with the request body.

Parameter Type Description
consentedPermissionSet teamsAppPermissionSet The set of resource-specific permissions that are being consented to.

Note: The permissions consented to during the install must be the same as the resource-specific permissions present 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 present in the teamsAppDefinition, then the permissions can be omitted from a request body.

Response

If successful, this method returns a 201 Created response code. It doesn't return anything in the response body.

Examples

Example 1: Install an app for a user

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/users/5b649834-7412-4cce-9e69-176e95a394f5/teamwork/installedApps
Content-type: application/json

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

Response

The following example shows the response.

HTTP/1.1 201 Created

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/users/5b649834-7412-4cce-9e69-176e95a394f5/teamwork/installedApps
Content-Type: application/json

{
  "teamsApp@odata.bind": "https://graph.microsoft.com/beta/appCatalogs/teamsApps/12345678-9abc-def0-123456789a",
  "consentedPermissionSet": {
    "resourceSpecificPermissions": [
      {
        "permissionValue": "TeamsActivity.Send.User",
        "permissionType": "Application"
      }
    ]
  }
}

Response

The following example shows the response.

HTTP/1.1 201 Created

Microsoft Graph service-specific throttling limits