channel: doesUserHaveAccess
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 whether a user has access to a shared channel.
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) | ChannelMember.Read.All, ChannelMember.ReadWrite.All |
| Delegated (personal Microsoft account) | Not supported. |
| Application | ChannelMember.Read.All, ChannelMember.ReadWrite.All |
HTTP request
GET /teams/{team-id}/channels/{channel-id}/doesUserHaveAccess
Function parameters
In the request URL, provide the following query parameters with values. The following table shows the parameters that can be used with this function.
| Parameter | Type | Description |
|---|---|---|
| tenantId | String | The ID of the Azure Active Directory tenant that the user belongs to. The default value for this property is the current tenantId of the signed-in user or app. |
| userId | String | Unique identifier for the user. Either specify the userId or the userPrincipalName property in the request. |
| userPrincipalName | String | The user principal name (UPN) of the user. Either specify the userId or the userPrincipalName property in the request. |
Request headers
| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. |
Request body
Do not supply a request body for this function.
Response
If successful, this function returns a 200 OK response code and a Boolean in the response body.
Examples
Example 1: Check access for an internal user
The following is an example of a request that checks whether an internal user has access to a shared channel.
Request
The following is an example of a request.
GET https://graph.microsoft.com/beta/teams/0fddfdc5-f319-491f-a514-be1bc1bf9ddc/channels/19:33b76eea88574bd1969dca37e2b7a819@thread.skype/doesUserHaveAccess(userId='6285581f-484b-4845-9e01-60667f8b12ae')
Response
The following is an example of the response.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": true
}
Example 2: Check access for an external user
The following is an example of a request that uses the tenantId property to check whether an external user has access to a shared channel.
Request
The following is an example of a request.
GET https://graph.microsoft.com/beta/teams/0fddfdc5-f319-491f-a514-be1bc1bf9ddc/channels/19:33b76eea88574bd1969dca37e2b7a819@thread.skype/doesUserHaveAccess(userId='62855810-484b-4823-9e01-60667f8b12ae', tenantId='57fb72d0-d811-46f4-8947-305e6072eaa5')
Response
The following is an example of the response.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": true
}
Example 3: Check user access for a user using the user principal name
The following is an example of a request that uses the userPrincipalName property to check whether an internal user has access to a shared channel.
Request
The following is an example of a request.
GET https://graph.microsoft.com/beta/teams/0fddfdc5-f319-491f-a514-be1bc1bf9ddc/channels/19:33b76eea88574bd1969dca37e2b7a819@thread.skype/doesUserHaveAccess(userPrincipalName='john.doe@contoso.com')
Response
The following is an example of the response.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": false
}
Feedback
Submit and view feedback for