A feature must be re-activated when it is upgraded to a newer version. If you are upgrading several SharePoint sites, you can save a lot of time by using a SharePoint power shell script to re-activate the feature. We have, however, become aware of an error which you may receive when re-activating Event Management. The error message is as follows:
Exception calling "Add" with "1" argument(s): "A list, survey, discussion board , or document library with the specified title already exists in this Web site. Please choose another title."
Exception calling "Add" with "1" argument(s): "A list, survey, discussion board , or document library with the specified title already exists in this Web site. Please choose another title."
This error occurs when lists have been renamed and you try to re-activate the feature. It can, however, be fixed easily by entering a script into the SharePoint Management Shell.
$webs = Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All $featureID = [Guid]"19b71bce-18eb-451d-a20a-4973cfe07317" ForEach($w in $webs){ if($w.Features[$featureID]) { write-host ("Web: " + $w.Url) try{ $listNames = @(("Lists/Enrollments", "Enrollments"),("Lists/Topics", "Event Catalog"),("Lists/Events", "Scheduled Events")) $trainingLists = $w.Lists | where { $_.TemplateFeatureID -eq $featureID } ForEach($l in $trainingLists){ $listName = $listNames | where { $_[0] -eq $l.RootFolder.Url } if($listName){ if($l.Title -ne $listName[1]){ $currentTitle = $l.Title $l.Title = $listName[1] $listName[1] = $currentTitle $l.Update(); write-host ("List renamed from " + $currentTitle + " to " + $l.Title); } } } $w.Features.Remove($featureID); write-host "Feature deactivated" $w.Features.Add($featureID); write-host "Feature activated" } catch [exception] { write-host ("An error occurred: " + $_.Exception.Message) } finally{ ForEach($l in $trainingLists){ $listName = $listNames | where { $_[0] -eq $l.RootFolder.Url } if($listName){ if($l.Title -ne $listName[1]){ $currentTitle = $l.Title $l.Title = $listName[1] $listName[1] = $currentTitle $l.Update() write-host ("List renamed from " + $currentTitle + " to " + $l.Title); } } } } } }
$webs = Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All $featureID = [Guid]"19b71bce-18eb-451d-a20a-4973cfe07317" ForEach($w in $webs){ if($w.Features[$featureID]) { write-host ("Web: " + $w.Url) try{ $listNames = @(("Lists/Enrollments", "Enrollments"),("Lists/Topics", "Event Catalog"),("Lists/Events", "Scheduled Events")) $trainingLists = $w.Lists | where { $_.TemplateFeatureID -eq $featureID } ForEach($l in $trainingLists){ $listName = $listNames | where { $_[0] -eq $l.RootFolder.Url } if($listName){ if($l.Title -ne $listName[1]){ $currentTitle = $l.Title $l.Title = $listName[1] $listName[1] = $currentTitle $l.Update(); write-host ("List renamed from " + $currentTitle + " to " + $l.Title); } } } $w.Features.Remove($featureID); write-host "Feature deactivated" $w.Features.Add($featureID); write-host "Feature activated" } catch [exception] { write-host ("An error occurred: " + $_.Exception.Message) } finally{ ForEach($l in $trainingLists){ $listName = $listNames | where { $_[0] -eq $l.RootFolder.Url } if($listName){ if($l.Title -ne $listName[1]){ $currentTitle = $l.Title $l.Title = $listName[1] $listName[1] = $currentTitle $l.Update() write-host ("List renamed from " + $currentTitle + " to " + $l.Title); } } } } } }
These scripts rename any lists with changed names and then update the feature. The lists are then changed back to their original names.
I hope you found this information useful. If you have any problems or any other questions, please send an e-mail to [email protected] or post a comment.