Forum Discussion

AyushJain1730's avatar
AyushJain1730
Copper Contributor
May 24, 2023

OneDrive- createUploadSession API returning 400 response code

I was trying to create an upload session on OneDrive for Business account using Graph API, but it is returning 400 invalid request error.

 

I was passing fileSize in body and its giving 400 error code.

Without fileSize parameter it is working fine.

 

The API I am calling:  https://graph.microsoft.com/v1.0/users/{user-id}/drive/items/{folder-id}:/Presentation.pptx:/createUploadSession

 

body:

{

   "item":{

      "@microsoft.graph.conflictBehavior":"fail",

      "fileSize":75264

   },

   "fileSystemInfo":{

      "createdDateTime":"2023-05-17T11:49:47Z",

      "lastModifiedDateTime":"2023-05-17T11:49:55Z"

   }

}

 

In the documentation, it is written:

If the fileSize parameter is specified and exceeds the available quota, a 507 Insufficent Storage response will be returned and the upload session will not be created.

 

If it is not possible this way, is there any other way to know if the file can be uploaded without exceeding the quota?

 

I just want to know if the user has enough quota to upload the file.

 

Thanks

No RepliesBe the first to reply

Resources