Edit

Share via


List assignedRoles

Namespace: microsoft.graph

Get a list of all the roles assigned to a user in Viva Engage.

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

Note

Calling the /me endpoint requires a signed-in user and therefore a delegated permission. Application permissions aren't supported when using the /me endpoint.

HTTP request

GET /users/{userId}/employeeExperience/assignedRoles
GET /me/employeeExperience/assignedRoles

Note: The {userId} represents the office user ID.

Optional query parameters

This method supports the $filter (eq), $select, and $count OData query parameters. For general information, see OData query parameters. Only the displayName and id properties support the $filter parameter.

The following table shows how you can use OData query parameters with this API.

Description HTTP request
Filter assigned roles by display name GET /users/{userId}/employeeExperience/assignedRoles?$filter=displayName eq 'Corporate Communicator'
Get only the id property for a list of assigned roles GET /users/{userId}/employeeExperience/assignedRoles?$select=id
Include the total count of assigned roles GET /users/{userId}/employeeExperience/assignedRoles?$count=true

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a collection of engagementRole objects in the response body.

Examples

Example 1: Get a list of all the roles assigned to a signed-in user in Viva Engage

The following example shows how to get a list of all the roles assigned to a signed-in user in Viva Engage.

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/me/employeeExperience/assignedRoles

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/v1.0/$metadata#me/employeeExperience/assignedRoles",
  "value": [
    {
        "id": "ec791927-d09f-4f91-bd76-d3b05e1c1a31",
        "displayName": "Network Admin"
    },
    {
        "id": "b0de8e6d-4457-4722-bdc5-5a32a09bf064",
        "displayName": "Verified Admin"
    },
    {
        "id": "77aa7d76-bdf6-4cc0-80e2-fd1ac5a28471",
        "displayName": "Corporate Communicator"
    }
  ]
}

Example 2: Get a list of all the roles assigned to a user in Viva Engage

The following example shows how to get a list of all the roles assigned to a user in Viva Engage.

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/users/e8d9f6a2-1c34-4b7a-9f11-2a4d8b7c9e01/employeeExperience/assignedRoles

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/v1.0/$metadata#users/e8d9f6a2-1c34-4b7a-9f11-2a4d8b7c9e01/employeeExperience/assignedRoles",
  "value": [
    {
        "id": "ec791927-d09f-4f91-bd76-d3b05e1c1a31",
        "displayName": "Network Admin"
    },
    {
        "id": "b0de8e6d-4457-4722-bdc5-5a32a09bf064",
        "displayName": "Verified Admin"
    },
    {
        "id": "77aa7d76-bdf6-4cc0-80e2-fd1ac5a28471",
        "displayName": "Corporate Communicator"
    }
  ]
}