1

I called a web service in SharePoint designer with HTTP delete:

_api/web/lists/getbytitle('title1')/items(1)/roleassignments/getbyprincipalid('1')

The workflow returned "Forbidden" response status and the ULS log :

Exception occured in scope Microsoft.SharePoint.SPRoleAssignment.DeleteObject. Exception=System.Runtime.InteropServices.COMException (0x8102006D): The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

0

You need to send a security token (Request Digest) within your request header. It is stored in a html input with the DOM ID __REQUESTDIGEST on every site. E.g. an ajax call:

$.ajax({
    headers: {
        "Accept": "application/json; odata=verbose",
        "content-type": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val()
    },

The lack of the token is mostly the course of the mentioned error

  • add it into the request header in the sharepoint designer? – user48429 Nov 18 '15 at 8:46
  • name : X-RequestDigest ; type : string ; value : $("#__REQUESTDIGEST").val(). I have add this to the request header, the status is still forbidden. – user48429 Nov 18 '15 at 9:45
0

As @Dave mentioned, you need to specify the request digest to perform write operations in a REST call. But:

$("#__REQUESTDIGEST").val()

is JavaScript/jQuery code for obtaining the request digest, suitable for putting on a browser based form, but you can't use JavaScript in SharePoint designer.

In designer, you need to first call the web service _api/contextinfo to get the request digest, and then assign that request digest to the X-RequestDigest header and make the delete call.

Ref: SharePoint Designer Call HTTP Web service with RequestDigest

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.