Follow me on Twitter

Handle your Provider Hosted SharePoint App 'App Installed' event

I’m creating a Provider-hosted app, and I want to do some things when the app is installed/uninstalled. It isn’t immediately obvious how you set that up in VS2012. You set this up in your Visual Studio solution by clicking on the App project, and then looking in the properties of the project:

Somehow, this seems a really weird place to look for this option. Note that you can also handle Uninstalling or Upgraded events here too, though I’ve had some issues with the Uninstalling event – more on that later.

Once you’ve turned on handling for an app event then Visual Studio adds an ‘AppEventReceiver.svc’ service to your ASP website, and opens a class file for you to handle the event. Note that all events are handled by the ‘ProcessEvent’ method, so you’ll need to determine the type of the event yourself…