Espace de noms: microsoft.graph
Importante
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 .
Créez un objet customAppScope pour un fournisseur RBAC.
Actuellement, seul le fournisseur RBAC Exchange Online est pris en charge.
Cette API est disponible dans les déploiements de cloud national suivants.
| Service global |
Gouvernement des États-Unis L4 |
Us Government L5 (DOD) |
Chine gérée par 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme moins privilégiées pour cette API. Utilisez une autorisation ou des autorisations privilégiées plus élevées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, consultez Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez les informations de référence sur les autorisations.
| Type d’autorisation |
Autorisations avec privilèges minimum |
Autorisations privilégiées plus élevées |
| Déléguée (compte professionnel ou scolaire) |
RoleManagement.ReadWrite.Exchange |
Non disponible. |
| Déléguée (compte Microsoft personnel) |
Non prise en charge. |
Non prise en charge. |
| Application |
RoleManagement.ReadWrite.Exchange |
Non disponible. |
Requête HTTP
Pour un fournisseur Exchange Online :
POST /roleManagement/exchange/customAppScopes
Corps de la demande
Dans le corps de la demande, fournissez une représentation JSON d’un objet customAppScope .
Réponse
Si elle réussit, cette méthode renvoie un 201 Created code de réponse et un nouvel objet customAppScope dans le corps de la réponse.
Exemples
Demande
L’exemple suivant montre comment créer un objet customAppScope avec le typeRecipientScope pour un fournisseur Exchange Online.
POST https://graph.microsoft.com/beta/roleManagement/exchange/customAppScopes
Content-type: application/json
{
"type": "RecipientScope",
"displayName": "Protected Exec Users",
"customAttributes": {
"Exclusive": false,
"RecipientFilter": "Title -like 'VP*'"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new CustomAppScope
{
Type = "RecipientScope",
DisplayName = "Protected Exec Users",
CustomAttributes = new CustomAppScopeAttributesDictionary
{
AdditionalData = new Dictionary<string, object>
{
{
"Exclusive" , false
},
{
"RecipientFilter" , "Title -like 'VP*'"
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.RoleManagement.Exchange.CustomAppScopes.PostAsync(requestBody);
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCustomAppScope()
type := "RecipientScope"
requestBody.SetType(&type)
displayName := "Protected Exec Users"
requestBody.SetDisplayName(&displayName)
customAttributes := graphmodels.NewCustomAppScopeAttributesDictionary()
additionalData := map[string]interface{}{
exclusive := false
customAttributes.SetExclusive(&exclusive)
"RecipientFilter" : "Title -like 'VP*'",
}
customAttributes.SetAdditionalData(additionalData)
requestBody.SetCustomAttributes(customAttributes)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
customAppScopes, err := graphClient.RoleManagement().Exchange().CustomAppScopes().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CustomAppScope customAppScope = new CustomAppScope();
customAppScope.setType("RecipientScope");
customAppScope.setDisplayName("Protected Exec Users");
CustomAppScopeAttributesDictionary customAttributes = new CustomAppScopeAttributesDictionary();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("Exclusive", false);
additionalData.put("RecipientFilter", "Title -like 'VP*'");
customAttributes.setAdditionalData(additionalData);
customAppScope.setCustomAttributes(customAttributes);
CustomAppScope result = graphClient.roleManagement().exchange().customAppScopes().post(customAppScope);
const options = {
authProvider,
};
const client = Client.init(options);
const customAppScope = {
type: 'RecipientScope',
displayName: 'Protected Exec Users',
customAttributes: {
Exclusive: false,
RecipientFilter: 'Title -like \'VP*\''
}
};
await client.api('/roleManagement/exchange/customAppScopes')
.version('beta')
.post(customAppScope);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\CustomAppScope;
use Microsoft\Graph\Beta\Generated\Models\CustomAppScopeAttributesDictionary;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CustomAppScope();
$requestBody->setType('RecipientScope');
$requestBody->setDisplayName('Protected Exec Users');
$customAttributes = new CustomAppScopeAttributesDictionary();
$additionalData = [
'Exclusive' => false,
'RecipientFilter' => 'Title -like \'VP*\'',
];
$customAttributes->setAdditionalData($additionalData);
$requestBody->setCustomAttributes($customAttributes);
$result = $graphServiceClient->roleManagement()->exchange()->customAppScopes()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.DeviceManagement.Enrollment
$params = @{
type = "RecipientScope"
displayName = "Protected Exec Users"
customAttributes = @{
Exclusive = $false
RecipientFilter = "Title -like 'VP*'"
}
}
New-MgBetaRoleManagementExchangeCustomAppScope -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.custom_app_scope import CustomAppScope
from msgraph_beta.generated.models.custom_app_scope_attributes_dictionary import CustomAppScopeAttributesDictionary
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CustomAppScope(
type = "RecipientScope",
display_name = "Protected Exec Users",
custom_attributes = CustomAppScopeAttributesDictionary(
additional_data = {
"exclusive" : False,
"recipient_filter" : "Title -like 'VP*'",
}
),
)
result = await graph_client.role_management.exchange.custom_app_scopes.post(request_body)
Réponse
L’exemple suivant illustre la réponse.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/exchange/customAppScopes/$entity",
"id": "ae242973-f38a-471f-bffd-f111451e940b",
"type": "RecipientScope",
"displayName": "Protected Exec Users",
"customAttributes": {
"Exclusive": false,
"RecipientFilter": "Title -like 'VP*'"
}
}