List communities

Namespace: microsoft.graph

Get a list of the Viva Engage community objects and their properties.

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

HTTP request

GET /employeeExperience/communities

Optional query parameters

This method supports the $top, $select, and $expand OData query parameters to help customize the response. It also supports the $orderby parameter for the displayName property.

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 community objects in the response body.

Examples

Example 1: Get a list of communities

The following example shows how to get a list of Viva Engage communities.

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/employeeExperience/communities

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#employeeExperience/communities",
    "value": [
        {
            "id": "eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxOTEzMjYyODk5MjAifQ",
            "displayName": "All Company",
            "description": "This is the default group for everyone in the network",
            "privacy": "public",
            "groupId": "195d9ecd-f80e-4bab-af95-176eba253dfa"
        },
        {
            "id": "eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxOTE0NzY2Mzc2OTYifQ",
            "displayName": "TestCommunity5",
            "description": "Test community created via API",
            "privacy": "public",
            "groupId": "0bed8b86-5026-4a93-ac7d-56750cc099f1"
        }
    ]
}

Example 2: Get a list of communities with pagination

The following example shows how to get a list of Viva Engage communities using the $top query parameter to set the page size of results.

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/employeeExperience/communities?$top=2

Response

If the number of communities exceeds 20 or you use the $top query parameter to set the page size of results, multiple query requests might be necessary to retrieve all results. In this scenario, the API continues to return a reference to the next page of results in the @odata.nextLink property with each response until no more pages remain to be retrieved.

The following example shows the response that includes the @odata.nextLink property.

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#employeeExperience/communities",
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/employeeExperience/communities?$skiptoken=UVWlYzI7VjE7MTE2NDUzNDU3OTIwOzIwO0RlbW8tdGVzdC01OztEaXNwbGF5TmFtZTtmYWXYZTs",
    "value": [
        {
            "id": "eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxOTEzMjYyODk5MjAifQ",
            "displayName": "All Company",
            "description": "This is the default group for everyone in the network",
            "privacy": "public",
            "groupId": "195d9ecd-f80e-4bab-af95-176eba253dfa"
        },
        {
            "id": "eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIxOTE0NzY2Mzc2OTYifQ",
            "displayName": "TestCommunity5",
            "description": "Test community created via API",
            "privacy": "public",
            "groupId": "0bed8b86-5026-4a93-ac7d-56750cc099f1"
        }
    ]
}