Thursday, July 18, 2013

Event ID 6644 : Event manager error: Could not load file or assembly - Remove orphan evet handlers in SharePoint lists

שלום חברים,
הלקוח שלי ביצע מיגרציה לסביבת SharePoint 2010 מ- Moss 2007. לאחר המיגרציה (בוצעה לפני כחצי שנה) הופיע לעיתים קרובות ה-Error הבא ב- Event Log :



זה נובע בעיקר מחוסר ידיעה/תשומת לב לכל ה-DLL הרלוונטים ל- SharePoint(כולל של רכיבים שהוספו לחווה).
המשמעות של השגיאה היא, EventReceiver שהיה מקושר לרשימה לא רץ (לא קיים DLL ב-GAC) .

הפתרון הוא לבטל את הרישום של ה-Event לרשימה.
כתבתי Script ב- PowerShell , הרצתי אותו והבעיה שלי נפתרה.

מצ"ב ה-Script, תהנו :



# Get All SiteCollections
$siteCollection = Get-SPSite
 foreach ($site in $siteCollection)
 {
             <# Unmark the line below if you want to see the siteCollection Path each iteration
                   Write-Host "Site Collection Pathe :  " $site -foregroundcolor green #>
           
            #Check if there is a subsites under the SiteCollecyion if isn't write "The SubSite Doesn't Exist"
            if ($site.AllWebs.count -gt 0)
            {
              foreach($web in $site.AllWebs)
              {
              <# Unmark the line below if you want to see the SubSite Path each iteration
                   Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow#>

                         foreach ($list in $web.Lists)
                         {         
                              # Colelction of EventReceivers of the list
                               $ev = $list.EventReceivers
                                      
                             # Check if there is an EventReceivers
                               if ($ev.count -gt 0)
                               {
                                   
                       <# Unmark the line below if you want to see the List Name and the number of the EventReceivers
                             Write-Host "List Name :  " $list.Title -foregroundcolor Gray  
                            Write-Host "Number of eventRecivers in List :  " -foregroundcolor Gray -nonewline; Write-Host                             $ev.count -foregroundcolor Blue#>
                                               
                                    # Get the Curent EventReceiver
                                    foreach ($myev in $ev)
                                                {                      
                                     
                                                  if($myev.assembly -eq 'Write here the EventReceiver Assembly')
                                                   {
                                                            Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                                                            Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow
                                                            Write-Host "List Name :  " $list.Title -foregroundcolor Gray
                                                            Write-Host $myev.assembly -foregroundcolor cyan
                                                            $myev.delete()
                                                  }        
                                                }
                                       }
                         }
              }
            }
            else
            {
                        Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                        Write-Host "No SubSites" -foregroundcolor red
            }          
 }


בהצלחה !
רון נס.







============================================================================================================================================================================================================================================================




Hello Friends,
Befor 6 Months ,My client migrate his  Moss 2007 environment to SharePoint 2010 environment. After The Migration some Errors appeared frequently on the Event Log:



This is mainly due to lack of knowledge / attention to the relevant DLLs to SharePoint (including the components were added to the farm).
The Meaning of the error is the EventReceiver was linked to the list but was not running (there is no DLL in the GAC(.

The solution is to unregister the Event from the list.
I wrote a script inPowerShell, ran it, and my problem was solved.

Here is the script, enjoy:

# Get All SiteCollections
$siteCollection = Get-SPSite
 foreach ($site in $siteCollection)
 {
             <# Unmark the line below if you want to see the siteCollection Path each iteration
                   Write-Host "Site Collection Pathe :  " $site -foregroundcolor green #>
           
            #Check if there is a subsites under the SiteCollecyion if isn't write "The SubSite Doesn't Exist"
            if ($site.AllWebs.count -gt 0)
            {
              foreach($web in $site.AllWebs)
              {
              <# Unmark the line below if you want to see the SubSite Path each iteration
                   Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow#>

                         foreach ($list in $web.Lists)
                         {         
                              # Colelction of EventReceivers of the list
                               $ev = $list.EventReceivers
                                      
                             # Check if there is an EventReceivers
                               if ($ev.count -gt 0)
                               {
                                   
                       <# Unmark the line below if you want to see the List Name and the number of the EventReceivers
                             Write-Host "List Name :  " $list.Title -foregroundcolor Gray  
                            Write-Host "Number of eventRecivers in List :  " -foregroundcolor Gray -nonewline; Write-Host                             $ev.count -foregroundcolor Blue#>
                                               
                                    # Get the Curent EventReceiver
                                    foreach ($myev in $ev)
                                                {                      
                                     
                                                  if($myev.assembly -eq 'Write here the EventReceiver Assembly')
                                                   {
                                                            Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                                                            Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow
                                                            Write-Host "List Name :  " $list.Title -foregroundcolor Gray
                                                            Write-Host $myev.assembly -foregroundcolor cyan
                                                            $myev.delete()
                                                  }        
                                                }
                                       }
                         }
              }
            }
            else
            {
                        Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                        Write-Host "No SubSites" -foregroundcolor red
            }          
 }



 Good Luck :)

Ron Ness.