0

I created a provider-hosted app, with a MVC webapplication. Inside my SharePoint project, I created fields, contenttypes and lists. But now I need a solution for this.

1) I need to create permissionlevels, permissions and groups. Code for this is not the issue... lots of examples on internet. But how to ACTIVATE the code automatically on deployment. Since provider-hosted apps don't have EventReceivers with a "app installed" event.

2) I need to add an "approval workflow" to one of the lists. Same problem as above, is that it should be activated on deployment. + Code examples for how to activate the workflow are welcome!

1
  • You have two separate questions here, and as such, this should be separated into another question.
    – wjervis
    May 19, 2015 at 14:03

1 Answer 1

1

You're wrong asserting provider-hosted apps don't allow to handle AppInstalled event. It is absolutely possible. Refer to this documentation:
Handle events in apps for SharePoint

and to this sample:
SharePoint 2013: Create a provider-hosted app that customizes app installation

4
  • Looks like I was wrong, indeed. Thanks. Testing this now! May 19, 2015 at 13:24
  • 1
    :) In SharePoint-hosted Apps instead you don't have possibility to handle these events. This is one of the main differences when choosing between SP-hosted vs provider-hosted. Also, if your App is deployed via 'app-stapling' these events may not come through, as explained in this article: blogs.msdn.com/b/richard_dizeregas_blog/archive/2013/03/04/… May 19, 2015 at 13:47
  • Thanks for the extra info. You have any idea for second part of the question? (how to add an approval workflow to a list) I can mark the answer as correct after that. Thanks! May 19, 2015 at 13:57
  • As pointed out in comments, it should be split into a separate dedicated question. Anyway that should be straightforward with the other kind of additions or modifications that your App does, by accessing WorkflowAssociations property of your list, and add the new workflow associaton there -> stackoverflow.com/questions/5007715/… May 19, 2015 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.