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:

Capture

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…

Capture2

Advertisement
Handle your Provider Hosted SharePoint App 'App Installed' event

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.