0

I have just set up 2013 WFs on my SP 2016 Farm.

I have subsites with news lists - and I want to be able to send certain news items from the subsites to the top of the site collection.

I have followed multiple guides, including a few existing on this site.

I have elevated permissions for the workflow, on both source and target sites.

I have made multiple attempts to create the workflow, the first being ambitious and complex.

To try and understand my issues I have simplified to a workflow where -

I create dictionary (variable name: headers) with 'accept' and 'content-type' both as strings and set to 'application/json;odata=verbose'.

I have a second dictionary(variable name: dataType) with 'type' as a string and set to SP.Data.TestNewsListItem (TestNews being the name of my test list).

I then have a third (variable name: requestContent) and final dictionary with '__metadata' as a dictionary set to variable 'dataType'. I then have 3 fields Title(string), Body(string) and Published(date) with their values preset in the dictionary.

I then make my call to "https://mysite/news/_api/web/lists/getbytitle('TestNews')/items" Http method set to 'Http Post'

When I go to properties i have: address: as above

RequestType: Http Post

RequestHeaders: set to - variable: headers

RequestContent: set to - variable: requestContent

I have logged after each dictionary build, and everything displays as it should (as far as I know).

Nothing is ever created in my 'TestNews' list.

Any help would be greatly appreciated.

Thanks,

1 Answer 1

0

Did you specify "Call HTTP Web Service" action response properties to some workflow variables ? There exists Response Content, Response Headers properties. Did you log this response ? What result in this response ?

It can help you to solve issue faster.

When some years ago I create batch of SP 2013 workflows then I use this guide: https://rogereriksen.wordpress.com/2013/05/24/create-a-sharepoint-site-using-rest-in-workflow-with-sharepoint-designer/

And it always worked for me at last times.

You can try to gaming on this issue - try to simplify case and test different cases to understand if it working at all. Try to create GET request on current web, not POST to parent site. If it is worked then you can try to understand why POST not working or try to POST on current web and etc.

You can add X-RegestDigest header to your request headers and wrap all you Call HTTP Web Service actions in App Step.
Like here:
https://www.c-sharpcorner.com/blogs/using-call-http-web-service-in-spd-workflow-and-using-app-step

8
  • Morning, Thank you for your response. The guide you reference I have used. The responseContent returns - {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. you do not have permission to perform this action or access this resource/"}}}
    – Geolog1cal
    Dec 6, 2018 at 10:05
  • If you perform all guide steps with adding permissions through special page then I think you have following case. You must add X-RequestDigest to your request headers variable
    – user80188
    Dec 6, 2018 at 10:33
  • Thanks, I have been using this guide - fabiangwilliams.com/2013/09/03/… To get the x-RequestDigest. I have added this to fiddler, which still returns 401 unauthorised, followed by 403 forbidden.
    – Geolog1cal
    Dec 6, 2018 at 10:42
  • Can you try any GET request in Fiddler ? We need to understand is your problem in missing parameters for POST request or it is another permissions issue. It would be good to chat with you but I don't understand how to do it. Can you GET this list items? If YES then try to add some additional headers: "X-HTTP-Method":"MERGE", "IF-MATCH": "*"
    – user80188
    Dec 6, 2018 at 11:00
  • Or i think you can wrap your action in App Step in workfow. This will give you elevated privileges . like here: c-sharpcorner.com/blogs/… At this url you are already can see how to get X-RequestDigest in workflow step by step.
    – user80188
    Dec 6, 2018 at 11:09

Your Answer

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

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