Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Erstellen Sie ein neues customAppScope-Objekt für einen RBAC-Anbieter.
Derzeit wird nur der Exchange Online RBAC-Anbieter unterstützt.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
RoleManagement.ReadWrite.Exchange |
Nicht verfügbar. |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
RoleManagement.ReadWrite.Exchange |
Nicht verfügbar. |
HTTP-Anforderung
Für einen Exchange Online Anbieter:
POST /roleManagement/exchange/customAppScopes
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung eines customAppScope-Objekts an.
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 201 Created Antwortcode und ein neues customAppScope-Objekt im Antworttext zurück.
Beispiele
Anforderung
Das folgende Beispiel zeigt, wie Sie ein customAppScope-Objekt mit dem TypRecipientScope für einen Exchange Online Anbieter erstellen.
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)
Antwort
Das folgende Beispiel zeigt die Antwort.
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*'"
}
}