POST https://graph.microsoft.com/v1.0/deviceManagement/deviceManagementPartners
Content-type: application/json
Content-length: 803
{
"@odata.type": "#microsoft.graph.deviceManagementPartner",
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",
"partnerState": "unavailable",
"partnerAppType": "singleTenantApp",
"singleTenantAppId": "Single Tenant App Id value",
"displayName": "Display Name value",
"isConfigured": true,
"whenPartnerDevicesWillBeRemovedDateTime": "2016-12-31T23:56:38.2655023-08:00",
"whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime": "2016-12-31T23:58:42.2131231-08:00",
"groupsRequiringPartnerEnrollment": [
{
"@odata.type": "microsoft.graph.deviceManagementPartnerAssignment",
"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 DeviceManagementPartner
{
OdataType = "#microsoft.graph.deviceManagementPartner",
LastHeartbeatDateTime = DateTimeOffset.Parse("2016-12-31T23:59:37.9174975-08:00"),
PartnerState = DeviceManagementPartnerTenantState.Unavailable,
PartnerAppType = DeviceManagementPartnerAppType.SingleTenantApp,
SingleTenantAppId = "Single Tenant App Id value",
DisplayName = "Display Name value",
IsConfigured = true,
WhenPartnerDevicesWillBeRemovedDateTime = DateTimeOffset.Parse("2016-12-31T23:56:38.2655023-08:00"),
WhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime = DateTimeOffset.Parse("2016-12-31T23:58:42.2131231-08:00"),
GroupsRequiringPartnerEnrollment = new List<DeviceManagementPartnerAssignment>
{
new DeviceManagementPartnerAssignment
{
OdataType = "microsoft.graph.deviceManagementPartnerAssignment",
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.DeviceManagementPartners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc device-management device-management-partners create --body '{\
"@odata.type": "#microsoft.graph.deviceManagementPartner",\
"lastHeartbeatDateTime": "2016-12-31T23:59:37.9174975-08:00",\
"partnerState": "unavailable",\
"partnerAppType": "singleTenantApp",\
"singleTenantAppId": "Single Tenant App Id value",\
"displayName": "Display Name value",\
"isConfigured": true,\
"whenPartnerDevicesWillBeRemovedDateTime": "2016-12-31T23:56:38.2655023-08:00",\
"whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime": "2016-12-31T23:58:42.2131231-08:00",\
"groupsRequiringPartnerEnrollment": [\
{\
"@odata.type": "microsoft.graph.deviceManagementPartnerAssignment",\
"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.NewDeviceManagementPartner()
lastHeartbeatDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:59:37.9174975-08:00")
requestBody.SetLastHeartbeatDateTime(&lastHeartbeatDateTime)
partnerState := graphmodels.UNAVAILABLE_DEVICEMANAGEMENTPARTNERTENANTSTATE
requestBody.SetPartnerState(&partnerState)
partnerAppType := graphmodels.SINGLETENANTAPP_DEVICEMANAGEMENTPARTNERAPPTYPE
requestBody.SetPartnerAppType(&partnerAppType)
singleTenantAppId := "Single Tenant App Id value"
requestBody.SetSingleTenantAppId(&singleTenantAppId)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
isConfigured := true
requestBody.SetIsConfigured(&isConfigured)
whenPartnerDevicesWillBeRemovedDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:56:38.2655023-08:00")
requestBody.SetWhenPartnerDevicesWillBeRemovedDateTime(&whenPartnerDevicesWillBeRemovedDateTime)
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:42.2131231-08:00")
requestBody.SetWhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime(&whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime)
deviceManagementPartnerAssignment := graphmodels.NewDeviceManagementPartnerAssignment()
target := graphmodels.NewConfigurationManagerCollectionAssignmentTarget()
collectionId := "Collection Id value"
target.SetCollectionId(&collectionId)
deviceManagementPartnerAssignment.SetTarget(target)
groupsRequiringPartnerEnrollment := []graphmodels.DeviceManagementPartnerAssignmentable {
deviceManagementPartnerAssignment,
}
requestBody.SetGroupsRequiringPartnerEnrollment(groupsRequiringPartnerEnrollment)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceManagementPartners, err := graphClient.DeviceManagement().DeviceManagementPartners().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);
DeviceManagementPartner deviceManagementPartner = new DeviceManagementPartner();
deviceManagementPartner.setOdataType("#microsoft.graph.deviceManagementPartner");
OffsetDateTime lastHeartbeatDateTime = OffsetDateTime.parse("2016-12-31T23:59:37.9174975-08:00");
deviceManagementPartner.setLastHeartbeatDateTime(lastHeartbeatDateTime);
deviceManagementPartner.setPartnerState(DeviceManagementPartnerTenantState.Unavailable);
deviceManagementPartner.setPartnerAppType(DeviceManagementPartnerAppType.SingleTenantApp);
deviceManagementPartner.setSingleTenantAppId("Single Tenant App Id value");
deviceManagementPartner.setDisplayName("Display Name value");
deviceManagementPartner.setIsConfigured(true);
OffsetDateTime whenPartnerDevicesWillBeRemovedDateTime = OffsetDateTime.parse("2016-12-31T23:56:38.2655023-08:00");
deviceManagementPartner.setWhenPartnerDevicesWillBeRemovedDateTime(whenPartnerDevicesWillBeRemovedDateTime);
OffsetDateTime whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime = OffsetDateTime.parse("2016-12-31T23:58:42.2131231-08:00");
deviceManagementPartner.setWhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime(whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime);
LinkedList<DeviceManagementPartnerAssignment> groupsRequiringPartnerEnrollment = new LinkedList<DeviceManagementPartnerAssignment>();
DeviceManagementPartnerAssignment deviceManagementPartnerAssignment = new DeviceManagementPartnerAssignment();
deviceManagementPartnerAssignment.setOdataType("microsoft.graph.deviceManagementPartnerAssignment");
ConfigurationManagerCollectionAssignmentTarget target = new ConfigurationManagerCollectionAssignmentTarget();
target.setOdataType("microsoft.graph.configurationManagerCollectionAssignmentTarget");
target.setCollectionId("Collection Id value");
deviceManagementPartnerAssignment.setTarget(target);
groupsRequiringPartnerEnrollment.add(deviceManagementPartnerAssignment);
deviceManagementPartner.setGroupsRequiringPartnerEnrollment(groupsRequiringPartnerEnrollment);
DeviceManagementPartner result = graphClient.deviceManagement().deviceManagementPartners().post(deviceManagementPartner);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const deviceManagementPartner = {
'@odata.type': '#microsoft.graph.deviceManagementPartner',
lastHeartbeatDateTime: '2016-12-31T23:59:37.9174975-08:00',
partnerState: 'unavailable',
partnerAppType: 'singleTenantApp',
singleTenantAppId: 'Single Tenant App Id value',
displayName: 'Display Name value',
isConfigured: true,
whenPartnerDevicesWillBeRemovedDateTime: '2016-12-31T23:56:38.2655023-08:00',
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime: '2016-12-31T23:58:42.2131231-08:00',
groupsRequiringPartnerEnrollment: [
{
'@odata.type': 'microsoft.graph.deviceManagementPartnerAssignment',
target: {
'@odata.type': 'microsoft.graph.configurationManagerCollectionAssignmentTarget',
collectionId: 'Collection Id value'
}
}
]
};
await client.api('/deviceManagement/deviceManagementPartners')
.post(deviceManagementPartner);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceManagementPartner;
use Microsoft\Graph\Generated\Models\DeviceManagementPartnerTenantState;
use Microsoft\Graph\Generated\Models\DeviceManagementPartnerAppType;
use Microsoft\Graph\Generated\Models\DeviceManagementPartnerAssignment;
use Microsoft\Graph\Generated\Models\ConfigurationManagerCollectionAssignmentTarget;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceManagementPartner();
$requestBody->setOdataType('#microsoft.graph.deviceManagementPartner');
$requestBody->setLastHeartbeatDateTime(new \DateTime('2016-12-31T23:59:37.9174975-08:00'));
$requestBody->setPartnerState(new DeviceManagementPartnerTenantState('unavailable'));
$requestBody->setPartnerAppType(new DeviceManagementPartnerAppType('singleTenantApp'));
$requestBody->setSingleTenantAppId('Single Tenant App Id value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setIsConfigured(true);
$requestBody->setWhenPartnerDevicesWillBeRemovedDateTime(new \DateTime('2016-12-31T23:56:38.2655023-08:00'));
$requestBody->setWhenPartnerDevicesWillBeMarkedAsNonCompliantDateTime(new \DateTime('2016-12-31T23:58:42.2131231-08:00'));
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1 = new DeviceManagementPartnerAssignment();
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1->setOdataType('microsoft.graph.deviceManagementPartnerAssignment');
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target = new ConfigurationManagerCollectionAssignmentTarget();
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target->setOdataType('microsoft.graph.configurationManagerCollectionAssignmentTarget');
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target->setCollectionId('Collection Id value');
$groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1->setTarget($groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1Target);
$groupsRequiringPartnerEnrollmentArray []= $groupsRequiringPartnerEnrollmentDeviceManagementPartnerAssignment1;
$requestBody->setGroupsRequiringPartnerEnrollment($groupsRequiringPartnerEnrollmentArray);
$result = $graphServiceClient->deviceManagement()->deviceManagementPartners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.DeviceManagement.Administration
$params = @{
"@odata.type" = "#microsoft.graph.deviceManagementPartner"
lastHeartbeatDateTime = [System.DateTime]::Parse("2016-12-31T23:59:37.9174975-08:00")
partnerState = "unavailable"
partnerAppType = "singleTenantApp"
singleTenantAppId = "Single Tenant App Id value"
displayName = "Display Name value"
isConfigured = $true
whenPartnerDevicesWillBeRemovedDateTime = [System.DateTime]::Parse("2016-12-31T23:56:38.2655023-08:00")
whenPartnerDevicesWillBeMarkedAsNonCompliantDateTime = [System.DateTime]::Parse("2016-12-31T23:58:42.2131231-08:00")
groupsRequiringPartnerEnrollment = @(
@{
"@odata.type" = "microsoft.graph.deviceManagementPartnerAssignment"
target = @{
"@odata.type" = "microsoft.graph.configurationManagerCollectionAssignmentTarget"
collectionId = "Collection Id value"
}
}
)
}
New-MgDeviceManagementPartner -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.device_management_partner import DeviceManagementPartner
from msgraph.generated.models.device_management_partner_tenant_state import DeviceManagementPartnerTenantState
from msgraph.generated.models.device_management_partner_app_type import DeviceManagementPartnerAppType
from msgraph.generated.models.device_management_partner_assignment import DeviceManagementPartnerAssignment
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 = DeviceManagementPartner(
odata_type = "#microsoft.graph.deviceManagementPartner",
last_heartbeat_date_time = "2016-12-31T23:59:37.9174975-08:00",
partner_state = DeviceManagementPartnerTenantState.Unavailable,
partner_app_type = DeviceManagementPartnerAppType.SingleTenantApp,
single_tenant_app_id = "Single Tenant App Id value",
display_name = "Display Name value",
is_configured = True,
when_partner_devices_will_be_removed_date_time = "2016-12-31T23:56:38.2655023-08:00",
when_partner_devices_will_be_marked_as_non_compliant_date_time = "2016-12-31T23:58:42.2131231-08:00",
groups_requiring_partner_enrollment = [
DeviceManagementPartnerAssignment(
odata_type = "microsoft.graph.deviceManagementPartnerAssignment",
target = ConfigurationManagerCollectionAssignmentTarget(
odata_type = "microsoft.graph.configurationManagerCollectionAssignmentTarget",
collection_id = "Collection Id value",
),
),
],
)
result = await graph_client.device_management.device_management_partners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。