none
Delete orphan event receivers in a list that doesn't exist RRS feed

  • Question

  • Hi,

    I have a Site in SP2010 that reports some missing assemblies with the command Test-SPContentDatabase. I delete the missing assemblies in the Site, with a powershell that loop throw all the lists and delete the event receivers, but some missing assemblies can't be deleted because the list that host the event receiver doesn't exist.

    How can i delete this event receivers, to make a clean upgrade?

    I use the code from Etienne to identify the missing list:

    http://etienne-sharepoint.blogspot.com/2011/10/solving-missingassembly-errors-from.html

    Logs after executing, Upgrade-SPContentDatabase -id $DB:

    [powershell] [CmsVersionToVersionFeatureActivationSiteAction (13.0.1.0)] [INFO] [12/19/2012 11:16:34 AM]: SPSite Url=http://site:10000/
    [powershell] [CmsVersionToVersionFeatureActivationSiteAction (13.0.1.0)] [ERROR] [12/19/2012 11:16:34 AM]: Failed to activate site collection features on site http://site:10000/.
    [powershell] [CmsVersionToVersionFeatureActivationSiteAction (13.0.1.0)] [INFO] [12/19/2012 11:16:34 AM]: SPSite Url=http://site:10000/
    [powershell] [CmsVersionToVersionFeatureActivationSiteAction (13.0.1.0)] [ERROR] [12/19/2012 11:16:34 AM]: Exception: Object reference not set to an instance of an object.
    [powershell] [CmsVersionToVersionFeatureActivationSiteAction (13.0.1.0)] [INFO] [12/19/2012 11:16:34 AM]: SPSite Url=http://site:10000/
    [powershell] [CmsVersionToVersionFeatureActivationSiteAction (13.0.1.0)] [ERROR] [12/19/2012 11:16:34 AM]:    at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionFieldsAndContentTypes(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce)
       at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce)
       at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce)
       at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly)
       at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, String featureName, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope)
       at Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId)
       at Microsoft.SharePoint.Publishing.Internal.Upgrade.BaseUpgradeAction.ActivateFeature(SPFeatureCollection features, Guid featureGuid)
       at Microsoft.SharePoint.Publishing.Internal.Upgrade.BaseUpgradeAction.ActivateFeatures(SPFeatureCollection features, Guid[] featureGuids)
       at Microsoft.SharePoint.Publishing.Internal.Upgrade.CmsVersionToVersionFeatureActivationUpgradeAction.UpgradePublishingSite(SPSite site)


    • Edited by elalinde Wednesday, December 19, 2012 8:27 PM
    Wednesday, December 19, 2012 7:08 PM

Answers

  • Your farm will be in unsupported state if you run DDL statements against the database. Looks like the event receivers are in an orphaned state. I suggest opening a case with Microsoft to get it addressed.
    Thursday, December 20, 2012 8:39 PM

All replies

  • You can use a PowerShell script to delete the orphan list event receivers.

    How to add/delete an event receiver to a single list with PowerShell in SharePoint 2010

    Wednesday, December 19, 2012 10:20 PM
  • I alredy review that link with no luck, because the list in my site doesn't exist, i can't delete and event receiver without a list.

    Any other idea?

    Wednesday, December 19, 2012 10:27 PM
  • If you have access to the content database, you can quickly check the host of those event receivers and then use a PowerShell script to remove them.

    USE [<Content Database>]
    
    SELECT * FROM EventReceivers WITH (NOLOCK)
    WHERE Assembly='<Complete Assembly Name>'

    The HostId and HostType will help in identifying the event receiver host.

    http://msdn.microsoft.com/en-us/library/ee394866(v=prot.13).aspx

    Wednesday, December 19, 2012 10:55 PM
  • I check the query in the content database and all the event receivers have the HostType #2 (The event host is a list), then i do a join with table AllLists to get the list, but there is no list asociated with this event receivers.

    It's seems that in some point in time the lists were eliminated in SharePoint 2007 but the event receivers associated don't.

    I'm so tempted to delete this event receivers directly from the table in the database, but i know that you lose support from Microsoft when you touch the database.

    There is another option to delete this?

    Thursday, December 20, 2012 3:40 PM
  • Your farm will be in unsupported state if you run DDL statements against the database. Looks like the event receivers are in an orphaned state. I suggest opening a case with Microsoft to get it addressed.
    Thursday, December 20, 2012 8:39 PM
  • I have the same problem.

    How do/did you get rid of the event-receiver-entries ?

    Thursday, June 11, 2015 3:56 PM
  • If you are finding missing assembly dependencies in your Test-SPContentDatabase upgrade report associated with Host Type 2 (i.e., a list or document library), and the list or document library has been deleted, this can indicate that the list or document library object is still in the first or second stage recycle bins.  if you don't find it there, be sure to then check for items from that list or document library that might still be in the first or second stage recycle bins.
    Friday, December 7, 2018 9:33 PM