I've come across a really weird (and a little alarming) problem.
- I'm using Microsoft's sample users to test my integration - in this case Diego Siciliani
- I'm using a File Type input to pass FormData to PHP via Ajax
- The file upload gets saved to the organisation's shared folders in Sharepoint, instead of a specific personal folder in the user's OneDrive.
Here's my CURL:
$filename = $_FILES['file']['name'];
$headers = array(
"Authorization: Bearer " . $token,
"Host: graph.microsoft.com",
"Content-Type: application/json",
"Content-Length: 0",
);
$postfile = curl_init('https://graph.microsoft.com/v1.0/' . $userid . '/drive/root:/{folder}/' . $filename . ':/content');
curl_setopt($postfile, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($postfile, CURLOPT_HTTPHEADER, $headers);
curl_setopt($postfile, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($postfile);
curl_close($postfile);
This is what OneDrive looks like immediately after:
And this is what Sharepoint looks like immediately after:
Anyone know why this is happening?