Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
Tipo de permissão
Permissões com menos privilégios
Permissões com privilégios superiores
Delegado (conta corporativa ou de estudante)
Community.Read.All
Community.ReadWrite.All
Delegado (conta pessoal da Microsoft)
Sem suporte.
Sem suporte.
Application
Community.Read.All
Community.ReadWrite.All
Solicitação HTTP
GET /employeeExperience/communities
Parâmetros de consulta opcionais
Este método suporta os $topparâmetros de consulta , $selecte $expandOData para ajudar a personalizar a resposta. Também suporta o $orderby parâmetro para a propriedade displayName .
GET https://graph.microsoft.com/v1.0/employeeExperience/communities
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.EmployeeExperience.Communities.GetAsync();
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
communities, err := graphClient.EmployeeExperience().Communities().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CommunityCollectionResponse result = graphClient.employeeExperience().communities().get();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.employee_experience.communities.get()
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
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"
}
]
}
Exemplo 2: Obter uma lista de comunidades com paginação
O exemplo seguinte mostra como obter uma lista de comunidades Viva Engage com o $top parâmetro de consulta para definir o tamanho da página dos resultados.
GET https://graph.microsoft.com/v1.0/employeeExperience/communities?$top=2
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.EmployeeExperience.Communities.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Top = 2;
});
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphemployeeexperience "github.com/microsoftgraph/msgraph-sdk-go/employeeexperience"
//other-imports
)
requestTop := int32(2)
requestParameters := &graphemployeeexperience.EmployeeExperienceCommunitiesRequestBuilderGetQueryParameters{
Top: &requestTop,
}
configuration := &graphemployeeexperience.EmployeeExperienceCommunitiesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
communities, err := graphClient.EmployeeExperience().Communities().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CommunityCollectionResponse result = graphClient.employeeExperience().communities().get(requestConfiguration -> {
requestConfiguration.queryParameters.top = 2;
});
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.employee_experience.communities.communities_request_builder import CommunitiesRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = CommunitiesRequestBuilder.CommunitiesRequestBuilderGetQueryParameters(
top = 2,
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.employee_experience.communities.get(request_configuration = request_configuration)
Se o número de comunidades exceder 20 ou utilizar o $top parâmetro de consulta para definir o tamanho da página dos resultados, poderão ser necessários vários pedidos de consulta para obter todos os resultados. Neste cenário, a API continua a devolver uma referência à página seguinte dos resultados na propriedade @odata.nextLink com cada resposta até que não sejam obtidas mais páginas.
O exemplo seguinte mostra a resposta que inclui a propriedade @odata.nextLink .
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
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"
}
]
}