0

Following problem with using ShP 2013 enterprise on premises and ShPDesigner2013:

  1. Given a site http://server/site which holds two document libraries "docs1" and "docs2". Both libraries hold *.docx documents.
  2. The task: Create a ShPDesigner2013 workflow (for some reasons I can't use Visual Studio) which copies the selected document (current item) from docs1 to docs2.
  3. My problem: I have correctly built the request header (Accept - String - application/json;odata=verbose), but the "Call http web service" action with method=POST and http://server/site/_api/web/lists/GetFileByServerRelativeURL('/docs1/test.docx')/copyTo(strNewUrl='/server/site/docs2/test.docx',bOverwrite=true) doesn't work, it cancels with the following error message:

RequestorId: ad9824d3-039b-698e-615a-71e2f4b554df. Details: System.ApplicationException: HTTP 500 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["54"],"SPRequestGuid":["45bc2344-b620-4a4a-850b-0d5476b09e4e"],"request-id":["45bc2344-b620-4a4a-850b-0d5476b09e4e"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4841"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Tue, 26 Jun 2018 11:46:32 GMT"],"Server":["Microsoft-IIS/8.5"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

What am I doing wrong?

0

Firstly, ensure the http://server/site/_api/web/lists/GetFileByServerRelativeURL('/docs1/test.docx') call works because you're not really giving it a server-relative url (/site/docs1/test.docx in your example).

-> you can easily verify if the file was correctly referenced if it returns valid results in the browser or JSOM call.

Secondly, for strNewUrl also provide a server-relative url (/site/docs2/test.docx) => your example had the hostname part "/server" included.

  • If I enter http://server/site/_api/web/getFileByServerRelativeUrl('/site/docs1/test.docx')?$select=Title into the browser, it delivers a correct result. However, if entering into the CALL HTPP: http://server/site/_api/web/getFileByServerRelativeUrl('/site/docs1/test.docx')/copyTo(strNewUrl=''/site/docs2/TestDocTSG.docx',bOverwrite=true) it still cancels... – Helimac Jun 26 '18 at 14:27
  • The copyTo requires a POST which you cannot do by navigating to it with a browser. msdn.microsoft.com/en-us/library/office/… – Steven Van de Craen Jun 27 '18 at 8:58
  • Also, make sure you provide a valid request digest: docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/… – Steven Van de Craen Jun 27 '18 at 9:00
  • Thank you all, the problem is solved, thanks to the different hints on how to type correctly ... – Helimac Jul 10 '18 at 9:23
  • @Helimac - how do you fix this? – love thakker Dec 28 '18 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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