Forum Discussion

Bilal Fazli's avatar
Bilal Fazli
Brass Contributor
Sep 27, 2016

SharePoint REST API moveTo URL limitation

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?

 

jcgonzalezmartin

 

Help needed! 

 

  • 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)

     

     

    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

  • 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

    • Brent Ellis's avatar
      Brent Ellis
      Silver Contributor

      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?

      • Tony Hignett's avatar
        Tony Hignett
        Copper Contributor

        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)

         

         

        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