Applies to Event Management and Employee Training Management on SharePoint on-premisees
Error when re-activating Event Management or Employee Training Management site feature! What can I do?
Event Management and Employee Training Management were the first SharePoint add-ins we released for SharePoint 2010, later for SharePoint 2013, 2016 and finally SharePoint 2019 and SE. The apps are a great success and though the majority has moved over to Event Management or Employee Training Management on SharePoint online, there are still many customers using them in SharePoint on-premises environments.
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 or Employee Training 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."
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
!----Use the following Feature ID for Event Management
$featureID = [Guid]"19b71bce-18eb-451d-a20a-4973cfe07317"
!----Use the following Feature ID for Employee Training Management
!----$featureID = [Guid]"26583aab-d708-4dc1-92f1-36843fafcb40"
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 support.