POST https://graph.microsoft.com/v1.0/deviceManagement/importedWindowsAutopilotDeviceIdentities/import
Content-type: application/json
Content-length: 808
{
"importedWindowsAutopilotDeviceIdentities": [
{
"@odata.type": "#microsoft.graph.importedWindowsAutopilotDeviceIdentity",
"id": "985b4f49-4f49-985b-494f-5b98494f5b98",
"groupTag": "Group Tag value",
"serialNumber": "Serial Number value",
"productKey": "Product Key value",
"importId": "Import Id value",
"hardwareIdentifier": "aGFyZHdhcmVJZGVudGlmaWVy",
"state": {
"@odata.type": "microsoft.graph.importedWindowsAutopilotDeviceIdentityState",
"deviceImportStatus": "pending",
"deviceRegistrationId": "Device Registration Id value",
"deviceErrorCode": 15,
"deviceErrorName": "Device Error Name value"
},
"assignedUserPrincipalName": "Assigned User Principal Name value"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceManagement.ImportedWindowsAutopilotDeviceIdentities.Import;
using Microsoft.Graph.Models;
var requestBody = new ImportPostRequestBody
{
ImportedWindowsAutopilotDeviceIdentities = new List<ImportedWindowsAutopilotDeviceIdentity>
{
new ImportedWindowsAutopilotDeviceIdentity
{
OdataType = "#microsoft.graph.importedWindowsAutopilotDeviceIdentity",
Id = "985b4f49-4f49-985b-494f-5b98494f5b98",
GroupTag = "Group Tag value",
SerialNumber = "Serial Number value",
ProductKey = "Product Key value",
ImportId = "Import Id value",
HardwareIdentifier = Convert.FromBase64String("aGFyZHdhcmVJZGVudGlmaWVy"),
State = new ImportedWindowsAutopilotDeviceIdentityState
{
OdataType = "microsoft.graph.importedWindowsAutopilotDeviceIdentityState",
DeviceImportStatus = ImportedWindowsAutopilotDeviceIdentityImportStatus.Pending,
DeviceRegistrationId = "Device Registration Id value",
DeviceErrorCode = 15,
DeviceErrorName = "Device Error Name value",
},
AssignedUserPrincipalName = "Assigned User Principal Name 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.ImportedWindowsAutopilotDeviceIdentities.Import.PostAsImportPostResponseAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
mgc device-management imported-windows-autopilot-device-identities import post --body '{\
"importedWindowsAutopilotDeviceIdentities": [\
{\
"@odata.type": "#microsoft.graph.importedWindowsAutopilotDeviceIdentity",\
"id": "985b4f49-4f49-985b-494f-5b98494f5b98",\
"groupTag": "Group Tag value",\
"serialNumber": "Serial Number value",\
"productKey": "Product Key value",\
"importId": "Import Id value",\
"hardwareIdentifier": "aGFyZHdhcmVJZGVudGlmaWVy",\
"state": {\
"@odata.type": "microsoft.graph.importedWindowsAutopilotDeviceIdentityState",\
"deviceImportStatus": "pending",\
"deviceRegistrationId": "Device Registration Id value",\
"deviceErrorCode": 15,\
"deviceErrorName": "Device Error Name value"\
},\
"assignedUserPrincipalName": "Assigned User Principal Name value"\
}\
]\
}\
'
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// 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"
graphdevicemanagement "github.com/microsoftgraph/msgraph-sdk-go/devicemanagement"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphdevicemanagement.NewImportPostRequestBody()
importedWindowsAutopilotDeviceIdentity := graphmodels.NewImportedWindowsAutopilotDeviceIdentity()
id := "985b4f49-4f49-985b-494f-5b98494f5b98"
importedWindowsAutopilotDeviceIdentity.SetId(&id)
groupTag := "Group Tag value"
importedWindowsAutopilotDeviceIdentity.SetGroupTag(&groupTag)
serialNumber := "Serial Number value"
importedWindowsAutopilotDeviceIdentity.SetSerialNumber(&serialNumber)
productKey := "Product Key value"
importedWindowsAutopilotDeviceIdentity.SetProductKey(&productKey)
importId := "Import Id value"
importedWindowsAutopilotDeviceIdentity.SetImportId(&importId)
hardwareIdentifier := []byte("aGFyZHdhcmVJZGVudGlmaWVy")
importedWindowsAutopilotDeviceIdentity.SetHardwareIdentifier(&hardwareIdentifier)
state := graphmodels.NewImportedWindowsAutopilotDeviceIdentityState()
deviceImportStatus := graphmodels.PENDING_IMPORTEDWINDOWSAUTOPILOTDEVICEIDENTITYIMPORTSTATUS
state.SetDeviceImportStatus(&deviceImportStatus)
deviceRegistrationId := "Device Registration Id value"
state.SetDeviceRegistrationId(&deviceRegistrationId)
deviceErrorCode := int32(15)
state.SetDeviceErrorCode(&deviceErrorCode)
deviceErrorName := "Device Error Name value"
state.SetDeviceErrorName(&deviceErrorName)
importedWindowsAutopilotDeviceIdentity.SetState(state)
assignedUserPrincipalName := "Assigned User Principal Name value"
importedWindowsAutopilotDeviceIdentity.SetAssignedUserPrincipalName(&assignedUserPrincipalName)
importedWindowsAutopilotDeviceIdentities := []graphmodels.ImportedWindowsAutopilotDeviceIdentityable {
importedWindowsAutopilotDeviceIdentity,
}
requestBody.SetImportedWindowsAutopilotDeviceIdentities(importedWindowsAutopilotDeviceIdentities)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
import, err := graphClient.DeviceManagement().ImportedWindowsAutopilotDeviceIdentities().Import().PostAsImportPostResponse(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);
com.microsoft.graph.devicemanagement.importedwindowsautopilotdeviceidentities.importnamespace.ImportPostRequestBody importPostRequestBody = new com.microsoft.graph.devicemanagement.importedwindowsautopilotdeviceidentities.importnamespace.ImportPostRequestBody();
LinkedList<ImportedWindowsAutopilotDeviceIdentity> importedWindowsAutopilotDeviceIdentities = new LinkedList<ImportedWindowsAutopilotDeviceIdentity>();
ImportedWindowsAutopilotDeviceIdentity importedWindowsAutopilotDeviceIdentity = new ImportedWindowsAutopilotDeviceIdentity();
importedWindowsAutopilotDeviceIdentity.setOdataType("#microsoft.graph.importedWindowsAutopilotDeviceIdentity");
importedWindowsAutopilotDeviceIdentity.setId("985b4f49-4f49-985b-494f-5b98494f5b98");
importedWindowsAutopilotDeviceIdentity.setGroupTag("Group Tag value");
importedWindowsAutopilotDeviceIdentity.setSerialNumber("Serial Number value");
importedWindowsAutopilotDeviceIdentity.setProductKey("Product Key value");
importedWindowsAutopilotDeviceIdentity.setImportId("Import Id value");
byte[] hardwareIdentifier = Base64.getDecoder().decode("aGFyZHdhcmVJZGVudGlmaWVy");
importedWindowsAutopilotDeviceIdentity.setHardwareIdentifier(hardwareIdentifier);
ImportedWindowsAutopilotDeviceIdentityState state = new ImportedWindowsAutopilotDeviceIdentityState();
state.setOdataType("microsoft.graph.importedWindowsAutopilotDeviceIdentityState");
state.setDeviceImportStatus(ImportedWindowsAutopilotDeviceIdentityImportStatus.Pending);
state.setDeviceRegistrationId("Device Registration Id value");
state.setDeviceErrorCode(15);
state.setDeviceErrorName("Device Error Name value");
importedWindowsAutopilotDeviceIdentity.setState(state);
importedWindowsAutopilotDeviceIdentity.setAssignedUserPrincipalName("Assigned User Principal Name value");
importedWindowsAutopilotDeviceIdentities.add(importedWindowsAutopilotDeviceIdentity);
importPostRequestBody.setImportedWindowsAutopilotDeviceIdentities(importedWindowsAutopilotDeviceIdentities);
var result = graphClient.deviceManagement().importedWindowsAutopilotDeviceIdentities().importEscaped().post(importPostRequestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const importedWindowsAutopilotDeviceIdentity = {
importedWindowsAutopilotDeviceIdentities: [
{
'@odata.type': '#microsoft.graph.importedWindowsAutopilotDeviceIdentity',
id: '985b4f49-4f49-985b-494f-5b98494f5b98',
groupTag: 'Group Tag value',
serialNumber: 'Serial Number value',
productKey: 'Product Key value',
importId: 'Import Id value',
hardwareIdentifier: 'aGFyZHdhcmVJZGVudGlmaWVy',
state: {
'@odata.type': 'microsoft.graph.importedWindowsAutopilotDeviceIdentityState',
deviceImportStatus: 'pending',
deviceRegistrationId: 'Device Registration Id value',
deviceErrorCode: 15,
deviceErrorName: 'Device Error Name value'
},
assignedUserPrincipalName: 'Assigned User Principal Name value'
}
]
};
await client.api('/deviceManagement/importedWindowsAutopilotDeviceIdentities/import')
.post(importedWindowsAutopilotDeviceIdentity);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\DeviceManagement\ImportedWindowsAutopilotDeviceIdentities\Import\ImportPostRequestBody;
use Microsoft\Graph\Generated\Models\ImportedWindowsAutopilotDeviceIdentity;
use Microsoft\Graph\Generated\Models\ImportedWindowsAutopilotDeviceIdentityState;
use Microsoft\Graph\Generated\Models\ImportedWindowsAutopilotDeviceIdentityImportStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ImportPostRequestBody();
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1 = new ImportedWindowsAutopilotDeviceIdentity();
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setOdataType('#microsoft.graph.importedWindowsAutopilotDeviceIdentity');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setId('985b4f49-4f49-985b-494f-5b98494f5b98');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setGroupTag('Group Tag value');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setSerialNumber('Serial Number value');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setProductKey('Product Key value');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setImportId('Import Id value');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setHardwareIdentifier(\GuzzleHttp\Psr7\Utils::streamFor(base64_decode('aGFyZHdhcmVJZGVudGlmaWVy')));
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State = new ImportedWindowsAutopilotDeviceIdentityState();
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State->setOdataType('microsoft.graph.importedWindowsAutopilotDeviceIdentityState');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State->setDeviceImportStatus(new ImportedWindowsAutopilotDeviceIdentityImportStatus('pending'));
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State->setDeviceRegistrationId('Device Registration Id value');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State->setDeviceErrorCode(15);
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State->setDeviceErrorName('Device Error Name value');
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setState($importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1State);
$importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1->setAssignedUserPrincipalName('Assigned User Principal Name value');
$importedWindowsAutopilotDeviceIdentitiesArray []= $importedWindowsAutopilotDeviceIdentitiesImportedWindowsAutopilotDeviceIdentity1;
$requestBody->setImportedWindowsAutopilotDeviceIdentities($importedWindowsAutopilotDeviceIdentitiesArray);
$result = $graphServiceClient->deviceManagement()->importedWindowsAutopilotDeviceIdentities()->import()->post($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.DeviceManagement.Actions
$params = @{
importedWindowsAutopilotDeviceIdentities = @(
@{
"@odata.type" = "#microsoft.graph.importedWindowsAutopilotDeviceIdentity"
id = "985b4f49-4f49-985b-494f-5b98494f5b98"
groupTag = "Group Tag value"
serialNumber = "Serial Number value"
productKey = "Product Key value"
importId = "Import Id value"
hardwareIdentifier = [System.Text.Encoding]::ASCII.GetBytes("aGFyZHdhcmVJZGVudGlmaWVy")
state = @{
"@odata.type" = "microsoft.graph.importedWindowsAutopilotDeviceIdentityState"
deviceImportStatus = "pending"
deviceRegistrationId = "Device Registration Id value"
deviceErrorCode = 15
deviceErrorName = "Device Error Name value"
}
assignedUserPrincipalName = "Assigned User Principal Name value"
}
)
}
Import-MgDeviceManagementImportedWindowsAutopilotDeviceIdentity -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.devicemanagement.importedwindowsautopilotdeviceidentities.import.import_post_request_body import ImportPostRequestBody
from msgraph.generated.models.imported_windows_autopilot_device_identity import ImportedWindowsAutopilotDeviceIdentity
from msgraph.generated.models.imported_windows_autopilot_device_identity_state import ImportedWindowsAutopilotDeviceIdentityState
from msgraph.generated.models.imported_windows_autopilot_device_identity_import_status import ImportedWindowsAutopilotDeviceIdentityImportStatus
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ImportPostRequestBody(
imported_windows_autopilot_device_identities = [
ImportedWindowsAutopilotDeviceIdentity(
odata_type = "#microsoft.graph.importedWindowsAutopilotDeviceIdentity",
id = "985b4f49-4f49-985b-494f-5b98494f5b98",
group_tag = "Group Tag value",
serial_number = "Serial Number value",
product_key = "Product Key value",
import_id = "Import Id value",
hardware_identifier = base64.urlsafe_b64decode("aGFyZHdhcmVJZGVudGlmaWVy"),
state = ImportedWindowsAutopilotDeviceIdentityState(
odata_type = "microsoft.graph.importedWindowsAutopilotDeviceIdentityState",
device_import_status = ImportedWindowsAutopilotDeviceIdentityImportStatus.Pending,
device_registration_id = "Device Registration Id value",
device_error_code = 15,
device_error_name = "Device Error Name value",
),
assigned_user_principal_name = "Assigned User Principal Name value",
),
],
)
result = await graph_client.device_management.imported_windows_autopilot_device_identities.import.post(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
以下は、応答の例です。 注: 簡潔にするために、ここに示す応答オブジェクトは切り詰められている場合があります。 実際の呼び出しではすべてのプロパティが返されます。