One of the things that are missing in SharePoint Designer is an action to Move a document from one location to another. There are a lot of awesome articles out there to get started with SPD and Rest API’s. I personally had a lot of Fabian Williams his posts. http://fabiangwilliams.wordpress.com/tag/rest/ .. Paolo Prialorsi has a WSP with a custom move action: http://www.sharepoint-reference.com/Blog/Lists/Posts/Post.aspx?ID=37
I wanted it to do with REST to check out the possibilities. Workflows run under the credentials & user permissions of the one who initiates the request. So if we want to run the the workflow using different rights we need to use a App Step. Read more on: http://msdn.microsoft.com/en-us/library/jj822159.aspx
In my case I need to call {currentWebUri}/_api/web/lists/GetById(guid'{ListId}’)/Items({sourceItemID})/File/MoveTo(newUrl='{targetFolder}’,flags=’1′) .
When I translate this to SPD I’ll get:
A REST API Call has also a Request Header. This we need to fill up with the necessary parameters. To see what your parameters need to be, use fiddler to simulate your Rest API Call. I urge you to check Fabian’s blog for detailed information about how to do this. In my case I need one parameter Accept. If I want to provide this to my Rest API Call, I need to add it to a Dictionary.
When we combine these things together we’ve got:
If you move the file/item that this workflow was running on outside it’s document library/list, the workflow will become disassociated. The workflow will keep on being in a running state but it will have no document/item that it can attach to.
Hi ,
I tried the same but Getting bad request.
below is the My RequestURL.
https://SPonlineURL/sites/f503/_api/web/lists/GetByTitle('DraftResearchFiles‘)/Items(2121)/File/MoveTo(newUrl=’/sites/f503/PublishedResearchFiles1/R146952.pdf’,flags=’1′)
let me know if any issue with the above URL
I appreciate your help
THanks,
Vinit KUmar
Oh man, that post is 4 years old, since everything changes, I have no idea this still works.