// 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 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);
# 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)