Skip to main content

Cloud

Tales from a SharePoint 2010 Migration to 2013 – Part II

If you read my previous post on Tales from a SharePoint 2010 Migration to 2013, I described a client migration and some of our lessons learned.  At Perficient, we do many SharePoint migrations and we have learned a lot along the way.  Here is a challenge we faced when migrating lists from 2010 to 2013.  This same scenerio was found when doing a backup and restore of a site 2010/2010 with workflow lists, so it is possible this error could happen in different scenerios.
Issue:
When upgrading a list workflow to 2013 you may encounter that the list item workflow is being fired twice.  When you look at the list workflow settings via SharePoint designer, you will see that there is only the 1 workflow; however, in reality there are two!
In the case of the upgraded site – there are 14 hive event receivers and the 15 hive eventreceiver… see below:
 

PS C:\Windows\system32> $splist = $site.Lists[“listname”]
PS C:\Windows\system32> $events = $splist.EventReceivers
PS C:\Windows\system32> $events  | select-object ID,Assembly,Type

Id                                : 704b10c5-1674-439a-9e4c-e5bfad6385b0
Type                          : ItemAdded
Assembly                  : Microsoft.SharePoint, Version=14.0.0.0,Culture=neutral, PublicKeyToken=71e9bce111e9429c
Id                               : 4cd0f64a-4b71-4c3f-acfe-72cfc3d4fbd7
Type                         : ItemAdded
Assembly                 : Microsoft.SharePoint, Version=15.0.0.0,Culture=neutral, PublicKeyToken=71e9bce111e9429c

Script to fix the issue

$snapin = Get-PSSnapin | Where-Object {$_.Name –eq ‘Microsoft.SharePoint.PowerShell’}
if ($snapin -eq $null) {
Write-Host ”    ..  Loading SharePoint PowerShell Snapin” -ForegroundColor Green
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
}
Write-Host ”    Microsoft SharePoint PowerShell snapin loaded” -ForegroundColor Gray
$site = get-spweb(“sitenamehere”)
$splist = $site.Lists[“applicationsupport”]
$eventsCount = $splist.EventReceivers.Count
$events = $splist.EventReceivers
$assembly = “Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”
for ($cnt=0; $cnt -lt $eventsCount; $cnt++)
{
$event = $splist.EventReceivers[$cnt]
if ($event.Assembly -eq $assembly)
{
Write-Host “About to delete the event type $($event.Type)..[$($event.Assembly)]”
$splist.EventReceivers[$cnt].Delete()
if (-not $?)
{
Write-Host “Error: $_”
}
}
else
{
Write-Host “item not deleted: [$($splist.EventReceivers[$cnt].Assembly)]”
}
}

This basic script can be used to fix any duplicates found on workflow lists.  Check this out if you find you have workflows firing twice.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Suzanne George

Suzanne George, MCTS has developed, administered, and architected online web site applications since 1995 and has worked with many Technology Top 100 companies such as Netscape, AOL, Sun Microsystems, and Verio. With a focus on migrations, upgrades, and custom application and SharePoint integration with ESRI, Deltek Accounting Software, and SAP; she has often been asked to speak at conferences around the country. Currently, Suzanne sits on the MSL IT Manager Advisory Council, was a contributing author for SharePoint 2010 Administrators companion and the SharePoint Handbook, and is a Senior Solutions Architect for Perficient.

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram