Access denied error when programmatically starting a SharePoint 2013 workflow

Sometimes your SharePoint workflow refuses to start. Like the time I tried to programmatically start a SharePoint 2013 workflow within a timer job. When the timer job ran, the workflow attempted to start but ended in a Canceled state. When clicking the information icon from the Workflow Information page, I got the following (partial) error message:

Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {“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.”}}}

I found a lot of posts suggesting that the user kicking off the workflow needs to be in a certain SharePoint group, or the app pool user needs certain permissions, etc.

However, what finally solved my issue was enabling the Workflows can use app permissions feature from the Manage Site Features page. This forum post is what pointed me in the right direction.

I hope this helps somebody else out there!

 

(Visited 599 time, 1 visit today)