Whenever you are working with add-ins for SharePoint changes are high that you are using the add-in Parts in one way or another. As add-ins provide great value when working in the context of SharePoint itself. However recently we found ourselves fighting a rather strange issue. During the configuration of a intranet solution we added several add-In Parts to different sites and pages. During the timespan of the project some of the Add-in parts where disappearing from their pages. Once the add-in disappeared it was no longer possible to add it to the page again.
When investigating we found a workaround in uninstalling and re-installing the add-in. While this would solve the issue, such a solution is not really feasible. As it turns out it was related to the recycle bin. When uninstalling an Add-in from SharePoint you end up with an entry in the recycle bin.
Once an add-in is deleted and added to the recycle bin it will stay there for 93 days. After those 93 days the item will be deleted. When a user would clean up their recycle bin the items are moved to the second-stage recycle bin. If you delete an add-in you can also end up with multiple entries that look the same. You might have noticed when installing a new version of an add-in the GUID of the app web might change. Each add-in instance will be unique, so that’s why you might have multiple entries.
When looking at the second-stage recycle bin you will also see that it contains not only the ‘add-in’ but a separate node for the add-in web as well.
And that is where it gets interesting. As soon as an item is deleted from the second-stage recycle bin it will also delete any add-in parts that are configured on any pages in that site collection. So back to our case we added some add-ins to the webs, deleted them and later added them again. Just to find out that, exactly 93 days later, it turns out the add-in parts where deleted from the pages.
So whenever you are configuring a tenant, make sure that you delete the add-ins from both the recycle bin and the second-stage recycle bin before adding the same add-in again. It really screws up your day if the add-in itself is present in the site or web. Yet the add-in part is gone and you have no option to add it again without deleting and reinstalling the add-in.