Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when createUploadSession on OneDrive graph api for the special AppFolder

I am attempting to create an upload session in the special app folder for my OneDrive app using the Graph API. My app have the following permissions:

Files.ReadWrite 
Files.ReadWrite.AppFolder 
offline_access 

The request looks like this

https://graph.microsoft.com/v1.0/users/xxxxxx96-2e02-4300-8ab0-a05d73xxxxxx/drive/special/approot:/documentname.docx:/createUploadSession

gives the following error:

{
  "error": {
    "code": "itemNotFound",
    "message": "The resource could not be found.",
    "innerError": {
      "request-id": "7447aa01-6685-4af0-998a-64abc9b14825",
      "date": "2017-04-06T10:07:46"
    }
  }
}

I can create an upload session on the normal root folder without any errors:

graph.microsoft.com/v1.0/users/xxxxxx96-2e02-4300-8ab0-a05d73xxxxxx/drive/root:/documentname.docx:/createUploadSession  

result:

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
  "expirationDateTime": "2017-04-06T10:32:48.5252565Z",
  "nextExpectedRanges": [
    "0-"
  ],
  "uploadUrl": "......."
}
like image 539
Allan Avatar asked Apr 06 '17 10:04

Allan


1 Answers

The createuploadsession method does not support special/approot. As mentioned in the documentation, these are the only paths to use:
POST /drive/root:/{path_to_item}:/createUploadSession POST /drive/items/{parent_item_id}:/{filename}:/createUploadSession

like image 141
Joseph Gutierrez Avatar answered Sep 22 '22 11:09

Joseph Gutierrez