SOLVED

SharePoint REST API moveTo URL limitation

Brass Contributor

Hello community,

 

I am using SharePoint REST API in SharePoint (Online) 2013 Workflow to move documents b/w different libraries. It was working fine for files with small names but it failed for documents with very large names. 

 

For REST API we have to pass server relative URL in the moveTo method so it fails if my destination library structure contains nested folders and server relative URL becomes very lengthy.

 

1) Is there a work around for this URL limitation (260 characters)

1) Can i use "GetFileByID" or "GetFolderByID" to move documents using REST API?

 

@Juan Carlos González Martín

 

Help needed! 

 

5 Replies

Hi Bilal,

 

If i am correct you can get the docid and use that one. Only on the move you have to get the stream to put it in the new library.

 

hope it helps.

 

Paul

Resurrecting this instead of posting a new one.  I've just come upon this same issue.  Is there no way to work around this?

 

This is a url for a POST that is 296 characters long (and SUCCEEDS) (259 char excluding the tenant) - replaced with b's, x's, and y's to protect the innocent, but the following depicts exact length

https://bbbbbbbbbbbbbb.sharepoint.com/sites/customer/plan/_api/web/lists/getbyid('34b6672e-531e-443e-86a8-eeb17eb9259f')/items(172)/file/moveto(newurl='/sites/xxxxxxxx/yyyy/151/bbb bbbbb bbbbbbb bb (bb) bbbb/bb bbbbbbb bbb bbbbbbbb Reports/Service Reports 2015/2015 Sample Doc Five.docx',flags=1)

This is a url for a POST that is 298 characters long (and FAILS) (261 char excluding the tenant)

https://bbbbbbbbbbbbbb.sharepoint.com/sites/customer/plan/_api/web/lists/getbyid('34b6672e-531e-443e-86a8-eeb17eb9259f')/items(172)/file/moveto(newurl='/sites/customer/plan/151/bbb bbbbb bbbbbbb bb (bb) bbbb/bb bbbbbbb bbb bbbbbbbb Reports/Service Reports 2015/201501 Sample Doc Five.docx',flags=1)

 

There is no way at all to perform this file move using REST?

best response confirmed by Bilal Fazli (Brass Contributor)
Solution

Hi Brent

 

You can put the newUrl variable in a Dictionary.

The assign the Dictionary as the parmeters of the Call HTTP web service action.

The POST method will include it as payload.

 

then Build {...} Dictionary (Output to Variable: parameters)

 

Capture.JPG

 

The pass the Dictionary to the Call HTTP web Service action...

 

The Call [My Site/MyList/MyItem etc.]/file/MoveTo() HTTP web service with Variable:parameters (Response Content to.....

 

Hope this helps,

Tony

Perfect. Tony Hignett's solution works for files with Large names.

Hi, I know its been a while but could you elaborate a little more on the resolution.  I have run into the same issue using SharePoint 2013 designer workflow.  A screen shot would help.

 

Thanks

1 best response

Accepted Solutions
best response confirmed by Bilal Fazli (Brass Contributor)
Solution

Hi Brent

 

You can put the newUrl variable in a Dictionary.

The assign the Dictionary as the parmeters of the Call HTTP web service action.

The POST method will include it as payload.

 

then Build {...} Dictionary (Output to Variable: parameters)

 

Capture.JPG

 

The pass the Dictionary to the Call HTTP web Service action...

 

The Call [My Site/MyList/MyItem etc.]/file/MoveTo() HTTP web service with Variable:parameters (Response Content to.....

 

Hope this helps,

Tony

View solution in original post