Namespace: microsoft.graph
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.
Crie um novo objeto customAppScope para um fornecedor RBAC.
Atualmente, apenas o Exchange Online fornecedor RBAC é suportado.
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) |
RoleManagement.ReadWrite.Exchange |
Indisponível. |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
| Application |
RoleManagement.ReadWrite.Exchange |
Indisponível. |
Solicitação HTTP
Para um fornecedor de Exchange Online:
POST /roleManagement/exchange/customAppScopes
| Nome |
Descrição |
| Autorização |
{token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização. |
| Content-Type |
application/json. Obrigatório. |
Corpo da solicitação
No corpo do pedido, forneça uma representação JSON de um objeto personalizadoAppScope .
Resposta
Se for bem-sucedido, este método devolve um 201 Created código de resposta e um novo objeto customAppScope no corpo da resposta.
Exemplos
Solicitação
O exemplo seguinte mostra como criar um objeto personalizadoAppScope com o tipoRecipientScope para um fornecedor de 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)
Resposta
O exemplo a seguir mostra a resposta.
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*'"
}
}