SharePoint online (o365) add-in workflow – AppOnlySequence

If you are going to use “AppOnlySequence” workflow activity in a SP add-in, make sure you follow the below activities in order to grant the required permission by the workflow to execute successfully. If you have missed any of the steps, then the workflow will be suspended with the error “Exception: Access denied. You do not have permission to perform this action or access this resource.”

Step 1:

Enable the feature “Workflows can use app permissions” at site level (site settings -> site actions -> manage site features):

image1

Step 2:

In visual studio open AppManifest.xml and grant the app “Manage” permission.

image2

Step 3:

Tick the option “Allow the app to make app-only calls to SharePoint”

image3

You can also update the raw xml of AppManifest.xml with AllowAppOnlyPolicy=”true” instead of using the VS designer.

XML :

<AppPermissionRequests AllowAppOnlyPolicy=”true”>
<AppPermissionRequest Scope=”http://sharepoint/content/sitecollection/web&#8221; Right=”Manage” />
</AppPermissionRequests>