Approving list items through REST call in SharePoint 2013 Workflows using HttpSend Activity fails

REST services in SharePoint 2013 have become really powerful and enable to do a wide range of operations.

One of the scenarios is updating and approving list items.through REST service.

While i will not go in details on using the REST services (there are multiple samples already available on net)  you can see that we can easily update list items through REST. For Approving items we set the OData__ModerationStatus to 0.

This works fine in most cases but in case of SharePoint 2013 workflow you will find that approving items fails though updating list items goes through fine.

The SharePoint 2013 workflows are really like provider hosted apps and have a default set of permissions which does not include approve items permission.

 Perform the below steps to fix this

 
Go to "Site Settings" "Site App Permissions"

Find the App Workflow as copy the first guid as shown below


Go to https://<site collection Url>/_layouts/15/appInv.aspx.

Enter the Guid copied in previous step in the App ID and click on Lookup.

This will populate the Title, App Domain and Redirect URL columns.

Copy the below in Permission Request XML (copy as is and do not change the url in the Scope)

<AppPermissionRequests>

    <AppPermissionRequest
Scope="https://sharepoint/content/sitecollection/web"
Right="FullControl" />

  </AppPermissionRequests>

 

Click on Create and Trust the Workflow App

Test the workflow again and it should start working.

Note the list item needs to be in Pending state else the Approval with not work even with these steps.