How to copy a missing Site collection feature from one site to another site
-
08-02-2021 - |
Вопрос
I'm using SharePoint 2016 On- premises server.
From site collection ( Farm A) I've saved a site as a site template and uploaded the file in the solutions of site collection (Farm B), and activated it. Now I wanted to create a new sub-site using that activated solution. While doing so I'm getting errors mentioning that those features are not activated and hence I can't create a site.
On analyzing the error, I've activated the some features and reduced the error count,
Finally, I can't clear one error, because that one feature is not listed in the site collection(Farm B) features.
To solve the issue, I need to copy (from Farm A) and paste (to Farm B) the same site collection feature.
Please suggest a way to copy the feature from one site to another.
Решение
You can find the MissingFeature
in Farm A under this location (for CompatibilityLevel 15)
%Program Files%\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\<FeatureName>
Copy this folder to the corresponding path in Farm B, then install the missing feature in Farm B by executing
Install-SPFeature -path "<MissingFeature>" -CompatibilityLevel 15
Check the status of the feature by executing
Get-SPFeature -Identity "<MissingFeature>"
Reference: Install-SPFeature. Get-SPFeature.
Другие советы
You can get the problematic feature details from the site collection A using the below command:
Get-SPFeature | Where {$_.DisplayName -eq "FeatureName"} | Select ID
Then activate that feature in Site Collection B using the below command:
Enable-SPFeature –Identity "FeatureName" –url http://YourSiteCollection-B-URL
Then, create the subsite using the custom template from Site Collection - B.
Modified Answer:
If you have custom features in installed in your dev server - you can export those solutions using the below script:
$dirName = "c:\Solutions"
foreach ($solution in Get-SPSolution)
{
$id = $Solution.SolutionID
$title = $Solution.Name
$filename = $Solution.SolutionFile.Name
$solution.SolutionFile.SaveAs("$dirName\$filename")
}
Source:
Export all Farm Solutions (WSP) from central admin with PowerShell in SharePoint:
Then - verify your "Web Server Extensions\15\TEMPLATE\FEATURES\" with the wsp name in your dev server - then deploy your all downloaded WSP solution to the prod server - then activate the feature in your site collection - Finally verify the "Web Server Extensions\15\TEMPLATE\FEATURES\" both in dev and prod server - if both are same, you are good to go.