Espaço de nomes: microsoft.graph.cloudLicensing
Importante
As APIs na versão /beta no Microsoft Graph estão sujeitas a alterações. Não há suporte para o uso dessas APIs em aplicativos de produção. Para determinar se uma API está disponível na v1.0, use o seletor Versão.
Obtenha uma lista dos objetos de loteamento e respetivas propriedades.
Esta API está disponível nas seguintes implementações de cloud nacionais.
| Serviço global |
US Government L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissões
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) |
CloudLicensing.Read |
CloudLicensing.Read.All, Directory.Read.All, Directory.ReadWrite.All |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
| Application |
CloudLicensing.Read.All |
Directory.Read.All, Directory.ReadWrite.All |
Solicitação HTTP
GET /admin/cloudLicensing/allotments
Parâmetros de consulta opcionais
Este método suporta os $selectparâmetros de consulta , $top, $expand, $applye $filter OData para ajudar a personalizar a resposta. Para obter informações gerais, acesse Parâmetros de consulta OData.
Corpo da solicitação
Não forneça um corpo de solicitação para esse método.
Resposta
Se for bem-sucedido, este método devolve um 200 OK código de resposta e uma coleção de objetos microsoft.graph.cloudLicensing.allotment no corpo da resposta.
Exemplos
Exemplo 1: Obter loteamentos
O exemplo seguinte mostra como obter objetos de loteamento .
Solicitação
O exemplo a seguir mostra uma solicitação.
GET https://graph.microsoft.com/beta/admin/cloudLicensing/allotments
// 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.Admin.CloudLicensing.Allotments.GetAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allotments, err := graphClient.Admin().CloudLicensing().Allotments().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.cloudlicensing.AllotmentCollectionResponse result = graphClient.admin().cloudLicensing().allotments().get();
const options = {
authProvider,
};
const client = Client.init(options);
let allotments = await client.api('/admin/cloudLicensing/allotments')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->admin()->cloudLicensing()->allotments()->get()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta 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.admin.cloud_licensing.allotments.get()
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.cloudLicensing.allotment",
"id": "551f1755-0184-9e51-0bc7-f32bae5a1afb",
"allottedUnits": 250,
"assignableTo": "user,group",
"consumedUnits": 224,
"services": [
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "user,group",
"planId": "9aaf7827-d63c-4b61-89c3-182f06f82e5c",
"planName": "EXCHANGE_S_STANDARD"
},
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "none",
"planId": "6f23d6a9-adbf-481c-8538-b4c095654487",
"planName": "M365_LIGHTHOUSE_CUSTOMER_PLAN1"
},
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "none",
"planId": "882e1d05-acd1-4ccb-8708-6ee03664b117",
"planName": "INTUNE_O365"
},
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "user,group",
"planId": "5e62787c-c316-451f-b873-1d05acd4d12c",
"planName": "BPOS_S_TODO_1"
}
],
"skuId": "4b9405b0-7788-4568-add1-99614e613b69",
"skuPartNumber": "EXCHANGESTANDARD"
}
]
}
Exemplo 2: Obter loteamentos com waitingMembers
O exemplo seguinte mostra como obter objetos de loteamento , incluindo os respetivos waitingMembers.
Solicitação
O exemplo a seguir mostra uma solicitação.
GET https://graph.microsoft.com/beta/admin/cloudLicensing/allotments?$select=id,allottedUnits,consumedUnits,assignableTo&$expand=waitingMembers($select=id,waitingSinceDateTime)
// 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.Admin.CloudLicensing.Allotments.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "id","allottedUnits","consumedUnits","assignableTo" };
requestConfiguration.QueryParameters.Expand = new string []{ "waitingMembers($select=id,waitingSinceDateTime)" };
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphadmin "github.com/microsoftgraph/msgraph-beta-sdk-go/admin"
//other-imports
)
requestParameters := &graphadmin.CloudLicensingAllotmentsRequestBuilderGetQueryParameters{
Select: [] string {"id","allottedUnits","consumedUnits","assignableTo"},
Expand: [] string {"waitingMembers($select=id,waitingSinceDateTime)"},
}
configuration := &graphadmin.CloudLicensingAllotmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allotments, err := graphClient.Admin().CloudLicensing().Allotments().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.cloudlicensing.AllotmentCollectionResponse result = graphClient.admin().cloudLicensing().allotments().get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"id", "allottedUnits", "consumedUnits", "assignableTo"};
requestConfiguration.queryParameters.expand = new String []{"waitingMembers($select=id,waitingSinceDateTime)"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let allotments = await client.api('/admin/cloudLicensing/allotments')
.version('beta')
.expand('waitingMembers($select=id,waitingSinceDateTime)')
.select('id,allottedUnits,consumedUnits,assignableTo')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Admin\CloudLicensing\Allotments\AllotmentsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AllotmentsRequestBuilderGetRequestConfiguration();
$queryParameters = AllotmentsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["id","allottedUnits","consumedUnits","assignableTo"];
$queryParameters->expand = ["waitingMembers(\$select=id,waitingSinceDateTime)"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->admin()->cloudLicensing()->allotments()->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.admin.cloud_licensing.allotments.allotments_request_builder import AllotmentsRequestBuilder
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 = AllotmentsRequestBuilder.AllotmentsRequestBuilderGetQueryParameters(
select = ["id","allottedUnits","consumedUnits","assignableTo"],
expand = ["waitingMembers($select=id,waitingSinceDateTime)"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.admin.cloud_licensing.allotments.get(request_configuration = request_configuration)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.cloudLicensing.allotment",
"id": "551f1755-0184-9e51-0bc7-f32bae5a1afb",
"allottedUnits": 250,
"assignableTo": "user,group",
"consumedUnits": 224,
"waitingMembers": [
{
"@odata.type": "#microsoft.graph.cloudLicensing.waitingMember",
"id": "49caea1b-ad15-64f1-70c5-5c5e3563d19c",
"waitingSinceDateTime": "2024-11-22T17:11:10.6635939+00:00"
}
]
}
]
}
Exemplo 3: Obter loteamentos e agregar unidades atribuídas
O exemplo seguinte mostra como obter objetos de loteamento e agregar unidades atribuídas.
Solicitação
O exemplo a seguir mostra uma solicitação.
GET https://graph.microsoft.com/beta/admin/cloudLicensing/allotments?$apply=groupby((skuId,skuPartNumber), aggregate(allottedUnits with sum as totalAllottedUnits, consumedUnits with sum as totalConsumedUnits))
// 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.Admin.CloudLicensing.Allotments.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Apply = "groupby((skuId,skuPartNumber), aggregate(allottedUnits with sum as totalAllottedUnits, consumedUnits with sum as totalConsumedUnits))";
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphadmin "github.com/microsoftgraph/msgraph-beta-sdk-go/admin"
//other-imports
)
requestApply := "groupby((skuId,skuPartNumber), aggregate(allottedUnits with sum as totalAllottedUnits, consumedUnits with sum as totalConsumedUnits))"
requestParameters := &graphadmin.CloudLicensingAllotmentsRequestBuilderGetQueryParameters{
Apply: &requestApply,
}
configuration := &graphadmin.CloudLicensingAllotmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allotments, err := graphClient.Admin().CloudLicensing().Allotments().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.cloudlicensing.AllotmentCollectionResponse result = graphClient.admin().cloudLicensing().allotments().get(requestConfiguration -> {
requestConfiguration.queryParameters.apply = "groupby((skuId,skuPartNumber), aggregate(allottedUnits with sum as totalAllottedUnits, consumedUnits with sum as totalConsumedUnits))";
});
const options = {
authProvider,
};
const client = Client.init(options);
let allotments = await client.api('/admin/cloudLicensing/allotments')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Admin\CloudLicensing\Allotments\AllotmentsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AllotmentsRequestBuilderGetRequestConfiguration();
$queryParameters = AllotmentsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->apply = "groupby((skuId,skuPartNumber), aggregate(allottedUnits with sum as totalAllottedUnits, consumedUnits with sum as totalConsumedUnits))";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->admin()->cloudLicensing()->allotments()->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.admin.cloud_licensing.allotments.allotments_request_builder import AllotmentsRequestBuilder
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 = AllotmentsRequestBuilder.AllotmentsRequestBuilderGetQueryParameters(
apply = "groupby((skuId,skuPartNumber), aggregate(allottedUnits with sum as totalAllottedUnits, consumedUnits with sum as totalConsumedUnits))",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.admin.cloud_licensing.allotments.get(request_configuration = request_configuration)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900",
"skuPartNumber": "ENTERPRISEPACK",
"totalAllottedUnits": 500,
"totalConsumedUnits": 425
},
{
"skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df",
"skuPartNumber": "ENTERPRISEPREMIUM",
"totalAllottedUnits": 200,
"totalConsumedUnits": 150
},
{
"skuId": "a4585165-0533-458a-97e3-c400570268c4",
"skuPartNumber": "SHAREPOINTSTANDARD",
"totalAllottedUnits": 300,
"totalConsumedUnits": 275
}
]
}