L’une des autorisations suivantes est nécessaire pour appeler cette API. Pour plus d’informations, notamment sur la façon de choisir les autorisations, voir Autorisations.
Type d’autorisation
Autorisations (de celle qui offre le plus de privilèges à celle qui en offre le moins)
POST /deviceManagement/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
POST /deviceManagement/detectedApps/{detectedAppId}/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
POST /deviceManagement/detectedApps/{detectedAppId}/managedDevices/{managedDeviceId}/users/{userId}/managedDevices/{managedDeviceId}/updateWindowsDeviceAccount
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceManagement.ManagedDevices.Item.UpdateWindowsDeviceAccount;
using Microsoft.Graph.Models;
var requestBody = new UpdateWindowsDeviceAccountPostRequestBody
{
UpdateWindowsDeviceAccountActionParameter = new UpdateWindowsDeviceAccountActionParameter
{
OdataType = "microsoft.graph.updateWindowsDeviceAccountActionParameter",
DeviceAccount = new WindowsDeviceAccount
{
OdataType = "microsoft.graph.windowsDeviceAccount",
Password = "Password value",
},
PasswordRotationEnabled = true,
CalendarSyncEnabled = true,
DeviceAccountEmail = "Device Account Email value",
ExchangeServer = "Exchange Server value",
SessionInitiationProtocalAddress = "Session Initiation Protocal Address value",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.DeviceManagement.ManagedDevices["{managedDevice-id}"].UpdateWindowsDeviceAccount.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.devicemanagement.manageddevices.item.updatewindowsdeviceaccount.UpdateWindowsDeviceAccountPostRequestBody updateWindowsDeviceAccountPostRequestBody = new com.microsoft.graph.devicemanagement.manageddevices.item.updatewindowsdeviceaccount.UpdateWindowsDeviceAccountPostRequestBody();
UpdateWindowsDeviceAccountActionParameter updateWindowsDeviceAccountActionParameter = new UpdateWindowsDeviceAccountActionParameter();
updateWindowsDeviceAccountActionParameter.setOdataType("microsoft.graph.updateWindowsDeviceAccountActionParameter");
WindowsDeviceAccount deviceAccount = new WindowsDeviceAccount();
deviceAccount.setOdataType("microsoft.graph.windowsDeviceAccount");
deviceAccount.setPassword("Password value");
updateWindowsDeviceAccountActionParameter.setDeviceAccount(deviceAccount);
updateWindowsDeviceAccountActionParameter.setPasswordRotationEnabled(true);
updateWindowsDeviceAccountActionParameter.setCalendarSyncEnabled(true);
updateWindowsDeviceAccountActionParameter.setDeviceAccountEmail("Device Account Email value");
updateWindowsDeviceAccountActionParameter.setExchangeServer("Exchange Server value");
updateWindowsDeviceAccountActionParameter.setSessionInitiationProtocalAddress("Session Initiation Protocal Address value");
updateWindowsDeviceAccountPostRequestBody.setUpdateWindowsDeviceAccountActionParameter(updateWindowsDeviceAccountActionParameter);
graphClient.deviceManagement().managedDevices().byManagedDeviceId("{managedDevice-id}").updateWindowsDeviceAccount().post(updateWindowsDeviceAccountPostRequestBody);
Voici un exemple de réponse. Remarque : l’objet de réponse illustré ici peut être tronqué à des fins de concision. Toutes les propriétés sont renvoyées à partir d’un appel réel.