Edit

Share via


teamwork: determineIfInteractionIsAllowed

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.

Determine if a specified Microsoft Teams interaction is allowed between the signed-in user and specified users.

Note: All requests to this API are logged in the Microsoft 365 audit logs of the tenants where the targeted users specified by the users parameter exist. For more information, see Audit log activities.

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) TeamworkUserInteraction.Read.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

HTTP request

POST /teamwork/determineIfInteractionIsAllowed

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the parameters.

The following table shows the parameters that you can use with this action.

Parameter Type Description
interactionType teamworkInteractionType The type of interaction on Microsoft Teams.
users identity collection The collection of target users with which the caller wants to determine whether interaction is allowed. The supported derived types are emailIdentity and teamworkUserIdentity.

Response

If successful, this action returns a 200 OK response code and a Boolean in the response body.

Examples

Example 1: Determine if the signed-in user can create a chat with another user in the same tenant using their ID

The following example shows a request that determines whether the signed-in user, authenticated via delegated context, can create a chat with another user in the same tenant by specifying the other user's ID.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed

{
  "users":
  [
    {
      "@odata.type": "microsoft.graph.teamworkUserIdentity",
      "id": "59b5bc69-ca73-4ffd-a2e0-88a79115d13b"
    }
  ],
  "interactionType": "createChat"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
  "value": true
}

Example 2: Determine if the signed-in user can create a chat with another user in a different tenant using their ID and tenant ID

The following example shows a request that determines whether the signed-in user, authenticated via delegated context, can create a chat with another user in a different tenant using the other user's ID and tenant ID.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed

{
  "users":
  [
    {
      "@odata.type": "microsoft.graph.teamworkUserIdentity",
      "id": "59b5bc69-ca73-4ffd-a2e0-88a79115d13b",
      "tenantId": "b11186db-6149-4b3d-95ad-23c9e1bf6853"
    }
  ],
  "interactionType": "createChat"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
  "value": true
}

Example 3: Determine if the signed-in user can create a chat with another user using their user principal name

The following example shows a request that determines whether the signed-in user, authenticated via delegated context, can create a chat with another user by specifying the other user's user principal name. When you specify the user principal name of a user in another tenant, tenantId doesn't need to be specified.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed

{
  "users":
  [
    {
      "@odata.type": "microsoft.graph.teamworkUserIdentity",
      "userPrincipalName": "maia@contoso.com"
    }
  ],
  "interactionType": "createChat"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
  "value": true
}

Example 4: Determine if the signed-in user can create a chat with another user using their email

The following example shows a request that determines whether the signed-in user, authenticated via delegated context, can create a chat with another user by specifying the other user's email.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed

{
  "users":
  [
    {
      "@odata.type": "microsoft.graph.emailIdentity",
      "email": "LauraW@contoso.com"
    }
  ],
  "interactionType": "createChat"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
  "value": true
}

Example 5: Determine if the signed-in user can create a chat with three other users

The following example shows a request that determines whether the signed-in user, authenticated via delegated context, can create a chat with three other users. It uses a mix of the supported identity types. In this example, the interaction isn't allowed.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed

{
  "users":
  [
    {
      "@odata.type": "microsoft.graph.emailIdentity",
      "email": "LauraW@foo.com"
    },
    {
      "@odata.type": "microsoft.graph.teamworkUserIdentity",
      "userPrincipalName": "MaiaR@foobar.com"
    },
    {
      "@odata.type": "microsoft.graph.teamworkUserIdentity",
      "id": "bd6a223f-59b5-46dd-90bc-0ddebaf3da5a"
    }
  ],
  "interactionType": "createChat"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
  "value": false
}