POST https://graph.microsoft.com/v1.0/deviceManagement/complianceManagementPartners
Content-type: application/json
Content-length: 1186
{
"@odata.type": "#microsoft.graph.complianceManagementPartner",
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",
"partnerState": "unavailable",
"displayName": "Display Name value",
"macOsOnboarded": true,
"androidOnboarded": true,
"iosOnboarded": true,
"macOsEnrollmentAssignments": [
{
"@odata.type": "microsoft.graph.complianceManagementPartnerAssignment",
"target": {
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",
"collectionId": "Collection Id value"
}
}
],
"androidEnrollmentAssignments": [
{
"@odata.type": "microsoft.graph.complianceManagementPartnerAssignment",
"target": {
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",
"collectionId": "Collection Id value"
}
}
],
"iosEnrollmentAssignments": [
{
"@odata.type": "microsoft.graph.complianceManagementPartnerAssignment",
"target": {
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",
"collectionId": "Collection Id value"
}
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new ComplianceManagementPartner
{
OdataType = "#microsoft.graph.complianceManagementPartner",
LastHeartbeatDateTime = DateTimeOffset.Parse("2016-12-31T23:59:37.9174975-08:00"),
PartnerState = DeviceManagementPartnerTenantState.Unavailable,
DisplayName = "Display Name value",
MacOsOnboarded = true,
AndroidOnboarded = true,
IosOnboarded = true,
MacOsEnrollmentAssignments = new List<ComplianceManagementPartnerAssignment>
{
new ComplianceManagementPartnerAssignment
{
OdataType = "microsoft.graph.complianceManagementPartnerAssignment",
Target = new ConfigurationManagerCollectionAssignmentTarget
{
OdataType = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
CollectionId = "Collection Id value",
},
},
},
AndroidEnrollmentAssignments = new List<ComplianceManagementPartnerAssignment>
{
new ComplianceManagementPartnerAssignment
{
OdataType = "microsoft.graph.complianceManagementPartnerAssignment",
Target = new ConfigurationManagerCollectionAssignmentTarget
{
OdataType = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
CollectionId = "Collection Id value",
},
},
},
IosEnrollmentAssignments = new List<ComplianceManagementPartnerAssignment>
{
new ComplianceManagementPartnerAssignment
{
OdataType = "microsoft.graph.complianceManagementPartnerAssignment",
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
var result = await graphClient.DeviceManagement.ComplianceManagementPartners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc device-management compliance-management-partners create --body '{\
"@odata.type": "#microsoft.graph.complianceManagementPartner",\
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",\
"partnerState": "unavailable",\
"displayName": "Display Name value",\
"macOsOnboarded": true,\
"androidOnboarded": true,\
"iosOnboarded": true,\
"macOsEnrollmentAssignments": [\
{\
"@odata.type": "microsoft.graph.complianceManagementPartnerAssignment",\
"target": {\
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",\
"collectionId": "Collection Id value"\
}\
}\
],\
"androidEnrollmentAssignments": [\
{\
"@odata.type": "microsoft.graph.complianceManagementPartnerAssignment",\
"target": {\
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",\
"collectionId": "Collection Id value"\
}\
}\
],\
"iosEnrollmentAssignments": [\
{\
"@odata.type": "microsoft.graph.complianceManagementPartnerAssignment",\
"target": {\
"@odata.type": "microsoft.graph.configurationManagerCollectionAssignmentTarget",\
"collectionId": "Collection Id value"\
}\
}\
]\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewComplianceManagementPartner()
lastHeartbeatDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:59:37.9174975-08:00")
requestBody.SetLastHeartbeatDateTime(&lastHeartbeatDateTime)
partnerState := graphmodels.UNAVAILABLE_DEVICEMANAGEMENTPARTNERTENANTSTATE
requestBody.SetPartnerState(&partnerState)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
macOsOnboarded := true
requestBody.SetMacOsOnboarded(&macOsOnboarded)
androidOnboarded := true
requestBody.SetAndroidOnboarded(&androidOnboarded)
iosOnboarded := true
requestBody.SetIosOnboarded(&iosOnboarded)
complianceManagementPartnerAssignment := graphmodels.NewComplianceManagementPartnerAssignment()
target := graphmodels.NewConfigurationManagerCollectionAssignmentTarget()
collectionId := "Collection Id value"
target.SetCollectionId(&collectionId)
complianceManagementPartnerAssignment.SetTarget(target)
macOsEnrollmentAssignments := []graphmodels.ComplianceManagementPartnerAssignmentable {
complianceManagementPartnerAssignment,
}
requestBody.SetMacOsEnrollmentAssignments(macOsEnrollmentAssignments)
complianceManagementPartnerAssignment := graphmodels.NewComplianceManagementPartnerAssignment()
target := graphmodels.NewConfigurationManagerCollectionAssignmentTarget()
collectionId := "Collection Id value"
target.SetCollectionId(&collectionId)
complianceManagementPartnerAssignment.SetTarget(target)
androidEnrollmentAssignments := []graphmodels.ComplianceManagementPartnerAssignmentable {
complianceManagementPartnerAssignment,
}
requestBody.SetAndroidEnrollmentAssignments(androidEnrollmentAssignments)
complianceManagementPartnerAssignment := graphmodels.NewComplianceManagementPartnerAssignment()
target := graphmodels.NewConfigurationManagerCollectionAssignmentTarget()
collectionId := "Collection Id value"
target.SetCollectionId(&collectionId)
complianceManagementPartnerAssignment.SetTarget(target)
iosEnrollmentAssignments := []graphmodels.ComplianceManagementPartnerAssignmentable {
complianceManagementPartnerAssignment,
}
requestBody.SetIosEnrollmentAssignments(iosEnrollmentAssignments)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
complianceManagementPartners, err := graphClient.DeviceManagement().ComplianceManagementPartners().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ComplianceManagementPartner complianceManagementPartner = new ComplianceManagementPartner();
complianceManagementPartner.setOdataType("#microsoft.graph.complianceManagementPartner");
OffsetDateTime lastHeartbeatDateTime = OffsetDateTime.parse("2016-12-31T23:59:37.9174975-08:00");
complianceManagementPartner.setLastHeartbeatDateTime(lastHeartbeatDateTime);
complianceManagementPartner.setPartnerState(DeviceManagementPartnerTenantState.Unavailable);
complianceManagementPartner.setDisplayName("Display Name value");
complianceManagementPartner.setMacOsOnboarded(true);
complianceManagementPartner.setAndroidOnboarded(true);
complianceManagementPartner.setIosOnboarded(true);
LinkedList<ComplianceManagementPartnerAssignment> macOsEnrollmentAssignments = new LinkedList<ComplianceManagementPartnerAssignment>();
ComplianceManagementPartnerAssignment complianceManagementPartnerAssignment = new ComplianceManagementPartnerAssignment();
complianceManagementPartnerAssignment.setOdataType("microsoft.graph.complianceManagementPartnerAssignment");
ConfigurationManagerCollectionAssignmentTarget target = new ConfigurationManagerCollectionAssignmentTarget();
target.setOdataType("microsoft.graph.configurationManagerCollectionAssignmentTarget");
target.setCollectionId("Collection Id value");
complianceManagementPartnerAssignment.setTarget(target);
macOsEnrollmentAssignments.add(complianceManagementPartnerAssignment);
complianceManagementPartner.setMacOsEnrollmentAssignments(macOsEnrollmentAssignments);
LinkedList<ComplianceManagementPartnerAssignment> androidEnrollmentAssignments = new LinkedList<ComplianceManagementPartnerAssignment>();
ComplianceManagementPartnerAssignment complianceManagementPartnerAssignment1 = new ComplianceManagementPartnerAssignment();
complianceManagementPartnerAssignment1.setOdataType("microsoft.graph.complianceManagementPartnerAssignment");
ConfigurationManagerCollectionAssignmentTarget target1 = new ConfigurationManagerCollectionAssignmentTarget();
target1.setOdataType("microsoft.graph.configurationManagerCollectionAssignmentTarget");
target1.setCollectionId("Collection Id value");
complianceManagementPartnerAssignment1.setTarget(target1);
androidEnrollmentAssignments.add(complianceManagementPartnerAssignment1);
complianceManagementPartner.setAndroidEnrollmentAssignments(androidEnrollmentAssignments);
LinkedList<ComplianceManagementPartnerAssignment> iosEnrollmentAssignments = new LinkedList<ComplianceManagementPartnerAssignment>();
ComplianceManagementPartnerAssignment complianceManagementPartnerAssignment2 = new ComplianceManagementPartnerAssignment();
complianceManagementPartnerAssignment2.setOdataType("microsoft.graph.complianceManagementPartnerAssignment");
ConfigurationManagerCollectionAssignmentTarget target2 = new ConfigurationManagerCollectionAssignmentTarget();
target2.setOdataType("microsoft.graph.configurationManagerCollectionAssignmentTarget");
target2.setCollectionId("Collection Id value");
complianceManagementPartnerAssignment2.setTarget(target2);
iosEnrollmentAssignments.add(complianceManagementPartnerAssignment2);
complianceManagementPartner.setIosEnrollmentAssignments(iosEnrollmentAssignments);
ComplianceManagementPartner result = graphClient.deviceManagement().complianceManagementPartners().post(complianceManagementPartner);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const complianceManagementPartner = {
'@odata.type': '#microsoft.graph.complianceManagementPartner',
lastHeartbeatDateTime: '2016-12-31T23:59:37.9174975-08:00',
partnerState: 'unavailable',
displayName: 'Display Name value',
macOsOnboarded: true,
androidOnboarded: true,
iosOnboarded: true,
macOsEnrollmentAssignments: [
{
'@odata.type': 'microsoft.graph.complianceManagementPartnerAssignment',
target: {
'@odata.type': 'microsoft.graph.configurationManagerCollectionAssignmentTarget',
collectionId: 'Collection Id value'
}
}
],
androidEnrollmentAssignments: [
{
'@odata.type': 'microsoft.graph.complianceManagementPartnerAssignment',
target: {
'@odata.type': 'microsoft.graph.configurationManagerCollectionAssignmentTarget',
collectionId: 'Collection Id value'
}
}
],
iosEnrollmentAssignments: [
{
'@odata.type': 'microsoft.graph.complianceManagementPartnerAssignment',
target: {
'@odata.type': 'microsoft.graph.configurationManagerCollectionAssignmentTarget',
collectionId: 'Collection Id value'
}
}
]
};
await client.api('/deviceManagement/complianceManagementPartners')
.post(complianceManagementPartner);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\ComplianceManagementPartner;
use Microsoft\Graph\Generated\Models\DeviceManagementPartnerTenantState;
use Microsoft\Graph\Generated\Models\ComplianceManagementPartnerAssignment;
use Microsoft\Graph\Generated\Models\ConfigurationManagerCollectionAssignmentTarget;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ComplianceManagementPartner();
$requestBody->setOdataType('#microsoft.graph.complianceManagementPartner');
$requestBody->setLastHeartbeatDateTime(new \DateTime('2016-12-31T23:59:37.9174975-08:00'));
$requestBody->setPartnerState(new DeviceManagementPartnerTenantState('unavailable'));
$requestBody->setDisplayName('Display Name value');
$requestBody->setMacOsOnboarded(true);
$requestBody->setAndroidOnboarded(true);
$requestBody->setIosOnboarded(true);
$macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1 = new ComplianceManagementPartnerAssignment();
$macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1->setOdataType('microsoft.graph.complianceManagementPartnerAssignment');
$macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target = new ConfigurationManagerCollectionAssignmentTarget();
$macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target->setOdataType('microsoft.graph.configurationManagerCollectionAssignmentTarget');
$macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target->setCollectionId('Collection Id value');
$macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1->setTarget($macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target);
$macOsEnrollmentAssignmentsArray []= $macOsEnrollmentAssignmentsComplianceManagementPartnerAssignment1;
$requestBody->setMacOsEnrollmentAssignments($macOsEnrollmentAssignmentsArray);
$androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1 = new ComplianceManagementPartnerAssignment();
$androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1->setOdataType('microsoft.graph.complianceManagementPartnerAssignment');
$androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target = new ConfigurationManagerCollectionAssignmentTarget();
$androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target->setOdataType('microsoft.graph.configurationManagerCollectionAssignmentTarget');
$androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target->setCollectionId('Collection Id value');
$androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1->setTarget($androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target);
$androidEnrollmentAssignmentsArray []= $androidEnrollmentAssignmentsComplianceManagementPartnerAssignment1;
$requestBody->setAndroidEnrollmentAssignments($androidEnrollmentAssignmentsArray);
$iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1 = new ComplianceManagementPartnerAssignment();
$iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1->setOdataType('microsoft.graph.complianceManagementPartnerAssignment');
$iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target = new ConfigurationManagerCollectionAssignmentTarget();
$iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target->setOdataType('microsoft.graph.configurationManagerCollectionAssignmentTarget');
$iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target->setCollectionId('Collection Id value');
$iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1->setTarget($iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1Target);
$iosEnrollmentAssignmentsArray []= $iosEnrollmentAssignmentsComplianceManagementPartnerAssignment1;
$requestBody->setIosEnrollmentAssignments($iosEnrollmentAssignmentsArray);
$result = $graphServiceClient->deviceManagement()->complianceManagementPartners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.DeviceManagement.Administration
$params = @{
"@odata.type" = "#microsoft.graph.complianceManagementPartner"
lastHeartbeatDateTime = [System.DateTime]::Parse("2016-12-31T23:59:37.9174975-08:00")
partnerState = "unavailable"
displayName = "Display Name value"
macOsOnboarded = $true
androidOnboarded = $true
iosOnboarded = $true
macOsEnrollmentAssignments = @(
@{
"@odata.type" = "microsoft.graph.complianceManagementPartnerAssignment"
target = @{
"@odata.type" = "microsoft.graph.configurationManagerCollectionAssignmentTarget"
collectionId = "Collection Id value"
}
}
)
androidEnrollmentAssignments = @(
@{
"@odata.type" = "microsoft.graph.complianceManagementPartnerAssignment"
target = @{
"@odata.type" = "microsoft.graph.configurationManagerCollectionAssignmentTarget"
collectionId = "Collection Id value"
}
}
)
iosEnrollmentAssignments = @(
@{
"@odata.type" = "microsoft.graph.complianceManagementPartnerAssignment"
target = @{
"@odata.type" = "microsoft.graph.configurationManagerCollectionAssignmentTarget"
collectionId = "Collection Id value"
}
}
)
}
New-MgDeviceManagementComplianceManagementPartner -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.compliance_management_partner import ComplianceManagementPartner
from msgraph.generated.models.device_management_partner_tenant_state import DeviceManagementPartnerTenantState
from msgraph.generated.models.compliance_management_partner_assignment import ComplianceManagementPartnerAssignment
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 = ComplianceManagementPartner(
odata_type = "#microsoft.graph.complianceManagementPartner",
last_heartbeat_date_time = "2016-12-31T23:59:37.9174975-08:00",
partner_state = DeviceManagementPartnerTenantState.Unavailable,
display_name = "Display Name value",
mac_os_onboarded = True,
android_onboarded = True,
ios_onboarded = True,
mac_os_enrollment_assignments = [
ComplianceManagementPartnerAssignment(
odata_type = "microsoft.graph.complianceManagementPartnerAssignment",
target = ConfigurationManagerCollectionAssignmentTarget(
odata_type = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
collection_id = "Collection Id value",
),
),
],
android_enrollment_assignments = [
ComplianceManagementPartnerAssignment(
odata_type = "microsoft.graph.complianceManagementPartnerAssignment",
target = ConfigurationManagerCollectionAssignmentTarget(
odata_type = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
collection_id = "Collection Id value",
),
),
],
ios_enrollment_assignments = [
ComplianceManagementPartnerAssignment(
odata_type = "microsoft.graph.complianceManagementPartnerAssignment",
target = ConfigurationManagerCollectionAssignmentTarget(
odata_type = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
collection_id = "Collection Id value",
),
),
],
)
result = await graph_client.device_management.compliance_management_partners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。