I'm trying to copy a file located in user's personal folder (OneDrive Pro) using REST API. The resulting link seems to become too long and server returns 400 BadRequest: The length of the URL for this request exceeds the configured maxUrlLength value.

Url looks like this (HTTP verb is POST):

https://<company>-my.sharepoint.com/personal/<user>_<company>_onmicrosoft_com/_api/Web/GetFileByServerRelativeUrl('/personal/<user>_<company>_onmicrosoft_com/Documents/<Folder>/<Folder with guid-like name>/<filename>.pdf')/copyto(strnewurl='/personal/<user>_<company>_onmicrosoft_com/Documents/<Same folder>/<another guid-like name>/<same filename>.pdf',boverwrite=true)

Any help or advice on how to overcome this is highly appreciated.

1 Answer 1


There is a maximum 256 character limit in SharePoint for REST URLs - reference:


However URL parameters are not included in the length-restriction, so can be used to get round this limit. Here is an example of using URL parameters to bypass this limit:


For a little more information you can see this post:

The length of the URL for this request exceeds the configured maxUrlLength value. REST API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.