Visigo / SharePointFBAPack

The SharePoint FBA Pack for SharePoint 2010, 2013, 2016 & 2019. Web parts and tools to manage your SharePoint forms based authentication users.
https://www.visigo.com/products/sharepoint-fba-pack
35 stars 14 forks source link

Update deploy script to clean orphaned event receivers #109

Open ccoulson opened 6 years ago

ccoulson commented 6 years ago

ccoulson[CodePlex]
In older versions of the FBA Pack there was a bug where the FBA Pack created the membership review list event receiver on the Generic List template. As a result, new lists would inherit the event receiver and would cause exceptions to be posted to the log file.

Unfortunately undeploying/redeploying does not clean up these template level event receivers - it leaves them on the site.

Update the deployment script to search for these orphaned event receivers and remove them.

Instructions for removing the orphaned event receivers:

Check for the event receivers:

$site = Get-SPSite quotsite urlquot $site.EventReceivers

If there are any event receivers listed with an FBA Pack assembly, you can delete them like this:

First make sure that the event receiver you’re targeting uses the fba pack assembly. If it does, delete it.

$site.EventReceivers[0] $site.EventReceivers[0].Delete()

$site.EventReceivers[1] $site.EventReceivers[1].Delete()

...

Finally refresh the site to see if any fba pack event receivers still exist at the site level:

$site = Get-SPSite quotsite urlquot $site.EventReceivers

ccoulson commented 6 years ago

ccoulson[CodePlex]
** Closed by ccoulson 10/28/2017 8:56PM

ccoulson commented 6 years ago

jnelsoncpath[CodePlex]
That was the fix. All errors are gone and no function was harmed. Thank you!

ccoulson commented 6 years ago

jnelsoncpath[CodePlex]
Thank you Sir! I appreciate the notification about this script I received after dealing with this over time. I will get this to run and will post back results.