Skip to content

Commit 3a815fc

Browse files
committed
Explained when appuninstalling event receiver is triggered in dev and end-user scenarios
1 parent 8d9961d commit 3a815fc

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

Samples/Core.AppPartPropertyUIOverride/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
210210
Notes:
211211
- The custom category that is being looked for in an App Part on app pages is: **“Custom Category 1”** in this example. This category it’s searching on needs to be unique across all App Parts.
212212
- The specialized custom JavaScript file to load if the custom category is found is: **Contoso.OverrideExample.js**
213+
- The **AppUninstalling** event only fires when a user completely removes the app: the app needs to be deleted from the site recycle bins in an end-user scenario. In a development scenario the app needs to be removed from the “Apps in testing” library.
213214

214215
### SPECIALIZED CUSTOM JAVASCRIPT FILE ###
215216
The **Contoso.OverrideExample.js** file is a specially crafted JavaScript file that utilizes jQuery, the **Contoso.AppPartPropertyUIOverride.js** helper library (more on that below) and SP.JS (the SharePoint JavaScript Client Side Object Model (CSOM) to manipulate the App Part property UI at runtime.

Samples/Core.EventReceivers/readme.md

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
7575
return result;
7676
}
7777
```
78+
79+
Note:
80+
* The **AppUninstalling** event only fires when a user completely removes the app: the app needs to be deleted from the site recycle bins in an end-user scenario. In a development scenario the app needs to be removed from the “Apps in testing” library.
81+
7882
Our code runs the centrally located code to see if a list named “Remote Event Receiver Jobs” exists in the host web and, if it does not, it creates it. The code then checks to see if that list has a remote event receiver attached to it for the ItemAdded event and, if it does not, it attaches one.
7983

8084
```C#

Samples/Provisioning.ReR/readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ private void HandleItemUpdated(SPRemoteEventProperties properties)
161161
```
162162
After the site is provisioned the site request will have its status updated to “COMPLETED” or “ERROR” based on the outcome.
163163

164+
165+
## AppUninstalling event receiver ##
166+
When the app is uninstalled we’re also removing the event receiver. In order to make this work during debugging you’ll need to ensure that you navigate to the “Apps in testing” library and use the remove option on the app. This remove will trigger the app uninstalling event with the proper permissions to remove the created remote event handler. If you just close the browser or uninstall the app from the “site contents” then either the event receiver never fires or the event receivers runs with unsufficient permissions to remove the list added event receiver. The reason for this behavior is differences in app deployment when the app gets side loaded which is what Visual Studio does when you press F5.
167+
168+
When a user uninstalls a deployed app this moves the app to the site's recycle bin and will NOT trigger the appuninstalling event handler. The app needs to be removed from all recycle bins in order to trigger the appuninstalled event.
169+
164170
# SHAREPOINT ONLINE SETUP #
165171

166172
The first step to create the application principal. The app principal is an actual principal in SharePoint 2013 for the app that can be granted permissions. To register the app principal, we will use the “_layouts/AppRegNew.aspx”.

Scenarios/Core.EventReceiversBasedModifications/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ private void HandleListAdded(SPRemoteEventProperties properties)
100100
## DEALING WITH UNINSTALL ##
101101
When the app is uninstalled we’re also removing the event receiver. In order to make this work during debugging you’ll need to ensure that you navigate to the “Apps in testing” library and use the remove option on the app. This remove will trigger the app uninstalling event with the proper permissions to remove the created remote event handler. If you just close the browser or uninstall the app from the “site contents” then either the event receiver never fires or the event receivers runs with unsufficient permissions to remove the list added event receiver. The reason for this behavior is differences in app deployment when the app gets side loaded which is what Visual Studio does when you press F5.
102102

103+
When a user uninstalls a deployed app this moves the app to the site's recycle bin and will NOT trigger the appuninstalling event handler. The app needs to be removed from all recycle bins in order to trigger the appuninstalled event.
104+
105+
103106
### Note: ###
104107
If you’ve been experimenting a lot it often helps to test this sample in a clean developer site.
105108

Scenarios/Provisioning.SiteModifier/readme.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ In order to only remove the app entry in the Recents menu, the following code is
109109
}
110110
```
111111

112+
## AppUninstalling event receiver ##
113+
When the app is uninstalled we’re also removing the event receiver. In order to make this work during debugging you’ll need to ensure that you navigate to the “Apps in testing” library and use the remove option on the app. This remove will trigger the app uninstalling event with the proper permissions to remove the created remote event handler. If you just close the browser or uninstall the app from the “site contents” then either the event receiver never fires or the event receivers runs with unsufficient permissions to remove the list added event receiver. The reason for this behavior is differences in app deployment when the app gets side loaded which is what Visual Studio does when you press F5.
112114

113-
# Dependencies #
114-
- Microsoft.SharePoint.Client
115-
- Microsoft.SharePoint.Client.Runtime
116-
- OfficeDevPnP.Core
117-
115+
When a user uninstalls a deployed app this moves the app to the site's recycle bin and will NOT trigger the appuninstalling event handler. The app needs to be removed from all recycle bins in order to trigger the appuninstalled event.
118116

119117

0 commit comments

Comments
 (0)