Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie unter Berechtigungen.
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Geben Sie im Anforderungstext eine JSON-Darstellung des Objekts des Typs deviceManagementPartner an.
In der folgenden Tabelle sind die Eigenschaften aufgeführt, die angegeben werden müssen, wenn Sie ein Objekt des Typs deviceManagementPartner erstellen.
Eigenschaft
Typ
Beschreibung
id
String
ID der Entität
lastHeartbeatDateTime
DateTimeOffset
Zeitstempel des letzten Heartbeats nach Aktivierung der Option „Connect to Device management Partner“ durch den Administrator
// 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);
// 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);
<?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();
Nachfolgend sehen Sie ein Beispiel der Antwort. Hinweis: Das hier gezeigte Antwortobjekt ist möglicherweise aus Platzgründen abgeschnitten. Von einem tatsächlichen Aufruf werden alle Eigenschaften zurückgegeben.