Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Delete user from shared Apple device
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type |
Permissions (from least to most privileged) |
Delegated (work or school account) |
DeviceManagementManagedDevices.PrivilegedOperations.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementManagedDevices.PrivilegedOperations.All |
HTTP Request
POST /deviceManagement/managedDevices/{managedDeviceId}/deleteUserFromSharedAppleDevice
POST /deviceManagement/detectedApps/{detectedAppId}/managedDevices/{managedDeviceId}/deleteUserFromSharedAppleDevice
POST /deviceManagement/detectedApps/{detectedAppId}/managedDevices/{managedDeviceId}/users/{userId}/managedDevices/{managedDeviceId}/deleteUserFromSharedAppleDevice
Request body
In the request body, supply JSON representation of the parameters.
The following table shows the parameters that can be used with this action.
Property |
Type |
Description |
userPrincipalName |
String |
Not yet documented |
Response
If successful, this action returns a 204 No Content
response code.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{managedDeviceId}/deleteUserFromSharedAppleDevice
Content-type: application/json
Content-length: 56
{
"userPrincipalName": "User Principal Name value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceManagement.ManagedDevices.Item.DeleteUserFromSharedAppleDevice;
var requestBody = new DeleteUserFromSharedAppleDevicePostRequestBody
{
UserPrincipalName = "User Principal Name 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}"].DeleteUserFromSharedAppleDevice.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-management managed-devices delete-user-from-shared-apple-device post --managed-device-id {managedDevice-id} --body '{\
"userPrincipalName": "User Principal Name value"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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"
//other-imports
)
requestBody := graphdevicemanagement.NewDeleteUserFromSharedAppleDevicePostRequestBody()
userPrincipalName := "User Principal Name value"
requestBody.SetUserPrincipalName(&userPrincipalName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.DeviceManagement().ManagedDevices().ByManagedDeviceId("managedDevice-id").DeleteUserFromSharedAppleDevice().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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.deleteuserfromsharedappledevice.DeleteUserFromSharedAppleDevicePostRequestBody deleteUserFromSharedAppleDevicePostRequestBody = new com.microsoft.graph.devicemanagement.manageddevices.item.deleteuserfromsharedappledevice.DeleteUserFromSharedAppleDevicePostRequestBody();
deleteUserFromSharedAppleDevicePostRequestBody.setUserPrincipalName("User Principal Name value");
graphClient.deviceManagement().managedDevices().byManagedDeviceId("{managedDevice-id}").deleteUserFromSharedAppleDevice().post(deleteUserFromSharedAppleDevicePostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const deleteUserFromSharedAppleDevice = {
userPrincipalName: 'User Principal Name value'
};
await client.api('/deviceManagement/managedDevices/{managedDeviceId}/deleteUserFromSharedAppleDevice')
.post(deleteUserFromSharedAppleDevice);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\DeleteUserFromSharedAppleDevice\DeleteUserFromSharedAppleDevicePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeleteUserFromSharedAppleDevicePostRequestBody();
$requestBody->setUserPrincipalName('User Principal Name value');
$graphServiceClient->deviceManagement()->managedDevices()->byManagedDeviceId('managedDevice-id')->deleteUserFromSharedAppleDevice()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
userPrincipalName = "User Principal Name value"
}
Remove-MgDeviceManagementManagedDeviceUserFromSharedAppleDevice -ManagedDeviceId $managedDeviceId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.devicemanagement.manageddevices.item.delete_user_from_shared_apple_device.delete_user_from_shared_apple_device_post_request_body import DeleteUserFromSharedAppleDevicePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeleteUserFromSharedAppleDevicePostRequestBody(
user_principal_name = "User Principal Name value",
)
await graph_client.device_management.managed_devices.by_managed_device_id('managedDevice-id').delete_user_from_shared_apple_device.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
HTTP/1.1 204 No Content