SharePoint

Access denied error when programmatically starting a SharePoint 2013 workflow

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 747 time, 1 visit today)

2 Comments

Click here to post a comment

  • Was this a custom workflow? Did you just turn the feature on, or turn it on then do something to the workflow so it knows to use app permissions?

    I found that my issue was that the person who uploaded the workflow, if their permission ever got revoked from the site, the workflow would get that error message.

  • Hi Paul, it was a SharePoint Designer 2013 workflow that I was trying to fire from code. All I did was turn on the feature, nothing else. I found a lot of stuff on permissions, seems like that is a common issue as well, but that didn’t turn out to be the cause of my issue.

About Me

Wendy Neal

Wendy Neal

I am a .NET SharePoint Developer for DMI. I've worked with SharePoint since 2007. I love to share my passion for SharePoint and Office 365 by speaking at various industry and user group events, as well as writing articles for various publications and this blog.   Read More

TwitterCounter for @SharePointWendy
MCSA Office 365
Top 50 SharePoint Blogs

Buy My Book

Archives

  • 2017 (1)
  • 2016 (8)
  • 2015 (23)
  • 2014 (20)
  • 2013 (22)
  • 2012 (15)
  • 2011 (13)