1

Have a provider hosted app that connects to my SPO 2013/O365 instance via App Only authentication. When the user submits through the app it creates a list item. I have a 2010 workflow set to kick off on item creation, grab an email address from a field, and send an email to that address, but for some reason the workflow never triggers. Heres what Ive tried/seen:

I can start the workflow manually and it works as expected.

I can have 2013 workflows trigger as expected.

I tried having the 2013 workflow start the 2010 workflow, but I get Access Denied when it tries to run the 2010 workflow. The other portions of the 2013 workflow run fine.

Tried wrapping the action to run the 2010 workflow in an App Step, but you cant use the Start 2010 workflow in an App Step.

Modified the 2010 workflow to only log a quick message to eliminate the possibility that its something with the workflow itself.

Ive given the app full control over the site collection.

Ive given everyone full control over the site collection.

Ive enabled Workflows can use app permissions feature.

Ive added the following to my AppManifest:

<AppPermissionRequests AllowAppOnlyPolicy="true" >
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
</AppPermissionRequests>

When I create a list item through the list itself rather than via the app everything works as expected. That includes running the 2010 workflow by itself as well as having the 2013 workflow kick off the 2010 workflow.

Still, nothing works. When I try and have the 2010 workflow run by itself on item creation its like its not even there. No errors, no logs.

Not sure if it could possibly be related to the way Im creating the item, but heres my code anyway:

List list = clientContext.Web.Lists.GetByTitle("List");
ListItemCreationInformation info = new ListItemCreationInformation();
Microsoft.SharePoint.Client.ListItem item = list.AddItem(info);
item.Update();
clientContext.Load(item);
clientContext.ExecuteQuery();

Im thinking that its either impossible to kick off the 2010 workflow from a 2013 app, or theres some other code I need to add to make it happen. Havent been able to find an answer to either yet.

0

Well, there was no easy way to go about this. Since the underlying issue was that the workflow wouldn't kick off due to permission issues with running the workflow through System Account I had to start it programmatically through my app and pass a separate set of predefined credentials through. Great resource here with the code I ended up using: http://www.vrdmn.com/2014/05/using-sharepoint-2013-workflow-interop.html

The only additional code I have aside from that post is that I had to pass the GUID for the item being submitted to the method I made to start the workflow. That was easy enough to grab:

Microsoft.SharePoint.Client.ListItem item = list.AddItem(info);
item.Update();
clientContext.Load(item);
clientContext.ExecuteQuery();
//Code to get the item GUID 
string newItemId = item["GUID"].ToString();
//Pass it to the method I created. 
startWorkflow(newItemId);

Bit of a pain as this added a few seconds to my submit process, so thats never good. At the end of the day, its Friday and it works, so thats whats happening for now.

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.