Submit a data policy operation request from a company administrator or an application to export an organizational user's data. This data includes the user's data stored in OneDrive and their activity reports. For more guidance about exporting data while complying with regulations, see Data Subject Requests and the GDPR and CCPA.
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)
User.Export.All
Delegated (personal Microsoft account)
Not applicable
Application
User.Export.All
Note: The export can only be performed by a company administrator when delegated permissions are used.
HTTP request
POST /users/{id}/exportPersonalData
Request headers
Name
Description
Authorization
Bearer {token}
Request body
In the request body, provide a JSON object with the following parameters.
Parameter
Type
Description
storageLocation
String
This is a shared access signature (SAS) URL to an Azure Storage account, to where data should be exported.
Response
If successful, this method returns a 202 Accepted response code. It does not return anything in the response body. The response contains the following response headers.
Name
Description
Location
URL to check on the status of the request.
Retry-After
Time period in seconds. Request maker should wait this long after submitting a request to check for the status.
POST https://graph.microsoft.com/v1.0/users/{id}/exportPersonalData
Content-type: application/json
{
"storageLocation": "storageLocation-value"
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Microsoft.Graph.Users.Item.ExportPersonalData.ExportPersonalDataPostRequestBody
{
StorageLocation = "storageLocation-value",
};
await graphClient.Users["{user-id}"].ExportPersonalData.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new ExportPersonalDataPostRequestBody();
$requestBody->setStorageLocation('storageLocation-value');
$graphServiceClient->users()->byUserId('user-id')->exportPersonalData()->post($requestBody);
// THE PYTHON SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
client = GraphServiceClient(request_adapter)
request_body = ExportPersonalDataPostRequestBody()
request_body.storage_location = 'storageLocation-value'
await client.users.by_user_id('user-id').export_personal_data.post(request_body = request_body)