Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Récupérer une liste d’objets usageRight pour un appareil donné.
Dans les scénarios délégués avec des comptes professionnels ou scolaires, l’utilisateur connecté doit se voir attribuer un rôle Microsoft Entra pris en charge ou un rôle personnalisé avec une autorisation de rôle prise en charge. Les rôles les moins privilégiés suivants sont pris en charge pour cette opération.
Lecteurs d’annuaire
Lecteur général
administrateur Intune
Windows 365
Requête HTTP
Vous pouvez traiter l’appareil à l’aide de son id ou de son id deviceId.
GET /devices/{objectId}/usageRights
GET /devices(deviceId='{deviceId}')/usageRights
Paramètres facultatifs de la requête
Cette API prend en charge le $filterparamètre de requête OData. Les modèles suivants de $filter sont pris en charge :
$filter = state eq 'value'
$filter = serviceIdentifier eq 'value'
$filter = state eq 'value' and serviceIdentifier eq 'value'
$filter = état dans ('value1', 'value2')
$filter = serviceIdentifier dans ('value1', 'value2')
$filter = état dans ('value1', 'value2') et serviceIdentifier dans ('value1', 'value2')
GET https://graph.microsoft.com/beta/devices/{objectId}/usageRights
// 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.Devices["{device-id}"].UsageRights.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
usageRights, err := graphClient.Devices().ByDeviceId("device-id").UsageRights().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UsageRightCollectionResponse result = graphClient.devices().byDeviceId("{device-id}").usageRights().get();
# 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.devices.by_device_id('device-id').usage_rights.get()
GET https://graph.microsoft.com/beta/devices/{objectId}/usageRights?$filter=state in ('active', 'suspended') and serviceIdentifier in ('ABCD')
// 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.Devices["{device-id}"].UsageRights.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')";
});
// 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"
graphdevices "github.com/microsoftgraph/msgraph-beta-sdk-go/devices"
//other-imports
)
requestFilter := "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')"
requestParameters := &graphdevices.ItemUsageRightsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphdevices.ItemUsageRightsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
usageRights, err := graphClient.Devices().ByDeviceId("device-id").UsageRights().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UsageRightCollectionResponse result = graphClient.devices().byDeviceId("{device-id}").usageRights().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')";
});
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Devices\Item\UsageRights\UsageRightsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new UsageRightsRequestBuilderGetRequestConfiguration();
$queryParameters = UsageRightsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->devices()->byDeviceId('device-id')->usageRights()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDeviceUsageRights -DeviceId $deviceId -Filter "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.devices.item.usage_rights.usage_rights_request_builder import UsageRightsRequestBuilder
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 = UsageRightsRequestBuilder.UsageRightsRequestBuilderGetQueryParameters(
filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.devices.by_device_id('device-id').usage_rights.get(request_configuration = request_configuration)