// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceAppManagement.TargetedManagedAppConfigurations.Item.Assign;
using Microsoft.Graph.Models;
var requestBody = new AssignPostRequestBody
{
Assignments = new List<TargetedManagedAppPolicyAssignment>
{
new TargetedManagedAppPolicyAssignment
{
OdataType = "#microsoft.graph.targetedManagedAppPolicyAssignment",
Id = "8b68c4a6-c4a6-8b68-a6c4-688ba6c4688b",
Target = new ConfigurationManagerCollectionAssignmentTarget
{
OdataType = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
CollectionId = "Collection Id value",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.DeviceAppManagement.TargetedManagedAppConfigurations["{targetedManagedAppConfiguration-id}"].Assign.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphdeviceappmanagement "github.com/microsoftgraph/msgraph-sdk-go/deviceappmanagement"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphdeviceappmanagement.NewAssignPostRequestBody()
targetedManagedAppPolicyAssignment := graphmodels.NewTargetedManagedAppPolicyAssignment()
id := "8b68c4a6-c4a6-8b68-a6c4-688ba6c4688b"
targetedManagedAppPolicyAssignment.SetId(&id)
target := graphmodels.NewConfigurationManagerCollectionAssignmentTarget()
collectionId := "Collection Id value"
target.SetCollectionId(&collectionId)
targetedManagedAppPolicyAssignment.SetTarget(target)
assignments := []graphmodels.TargetedManagedAppPolicyAssignmentable {
targetedManagedAppPolicyAssignment,
}
requestBody.SetAssignments(assignments)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.DeviceAppManagement().TargetedManagedAppConfigurations().ByTargetedManagedAppConfigurationId("targetedManagedAppConfiguration-id").Assign().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.deviceappmanagement.targetedmanagedappconfigurations.item.assign.AssignPostRequestBody assignPostRequestBody = new com.microsoft.graph.deviceappmanagement.targetedmanagedappconfigurations.item.assign.AssignPostRequestBody();
LinkedList<TargetedManagedAppPolicyAssignment> assignments = new LinkedList<TargetedManagedAppPolicyAssignment>();
TargetedManagedAppPolicyAssignment targetedManagedAppPolicyAssignment = new TargetedManagedAppPolicyAssignment();
targetedManagedAppPolicyAssignment.setOdataType("#microsoft.graph.targetedManagedAppPolicyAssignment");
targetedManagedAppPolicyAssignment.setId("8b68c4a6-c4a6-8b68-a6c4-688ba6c4688b");
ConfigurationManagerCollectionAssignmentTarget target = new ConfigurationManagerCollectionAssignmentTarget();
target.setOdataType("microsoft.graph.configurationManagerCollectionAssignmentTarget");
target.setCollectionId("Collection Id value");
targetedManagedAppPolicyAssignment.setTarget(target);
assignments.add(targetedManagedAppPolicyAssignment);
assignPostRequestBody.setAssignments(assignments);
graphClient.deviceAppManagement().targetedManagedAppConfigurations().byTargetedManagedAppConfigurationId("{targetedManagedAppConfiguration-id}").assign().post(assignPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Assign\AssignPostRequestBody;
use Microsoft\Graph\Generated\Models\TargetedManagedAppPolicyAssignment;
use Microsoft\Graph\Generated\Models\ConfigurationManagerCollectionAssignmentTarget;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AssignPostRequestBody();
$assignmentsTargetedManagedAppPolicyAssignment1 = new TargetedManagedAppPolicyAssignment();
$assignmentsTargetedManagedAppPolicyAssignment1->setOdataType('#microsoft.graph.targetedManagedAppPolicyAssignment');
$assignmentsTargetedManagedAppPolicyAssignment1->setId('8b68c4a6-c4a6-8b68-a6c4-688ba6c4688b');
$assignmentsTargetedManagedAppPolicyAssignment1Target = new ConfigurationManagerCollectionAssignmentTarget();
$assignmentsTargetedManagedAppPolicyAssignment1Target->setOdataType('microsoft.graph.configurationManagerCollectionAssignmentTarget');
$assignmentsTargetedManagedAppPolicyAssignment1Target->setCollectionId('Collection Id value');
$assignmentsTargetedManagedAppPolicyAssignment1->setTarget($assignmentsTargetedManagedAppPolicyAssignment1Target);
$assignmentsArray []= $assignmentsTargetedManagedAppPolicyAssignment1;
$requestBody->setAssignments($assignmentsArray);
$graphServiceClient->deviceAppManagement()->targetedManagedAppConfigurations()->byTargetedManagedAppConfigurationId('targetedManagedAppConfiguration-id')->assign()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.deviceappmanagement.targetedmanagedappconfigurations.item.assign.assign_post_request_body import AssignPostRequestBody
from msgraph.generated.models.targeted_managed_app_policy_assignment import TargetedManagedAppPolicyAssignment
from msgraph.generated.models.configuration_manager_collection_assignment_target import ConfigurationManagerCollectionAssignmentTarget
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AssignPostRequestBody(
assignments = [
TargetedManagedAppPolicyAssignment(
odata_type = "#microsoft.graph.targetedManagedAppPolicyAssignment",
id = "8b68c4a6-c4a6-8b68-a6c4-688ba6c4688b",
target = ConfigurationManagerCollectionAssignmentTarget(
odata_type = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
collection_id = "Collection Id value",
),
),
],
)
await graph_client.device_app_management.targeted_managed_app_configurations.by_targeted_managed_app_configuration_id('targetedManagedAppConfiguration-id').assign.post(request_body)
Veja a seguir um exemplo da resposta. Observação: o objeto response mostrado aqui pode estar truncado por motivos de concisão. Todas as propriedades serão retornadas de uma chamada real.