Issues with the feature extension

Feb 23, 2016 at 12:55 PM
Edited Feb 23, 2016 at 12:57 PM

I am having an issue with a very simple thing which I thought should work "out of the box". I am trying to activate the "SharePoint publishing infrastructure feature" on a site collection, but it is not working.

This is my what i write in the Features.xml

<Feature Name="PublishingSite">
        <Url Action="Enable" Force="false">$(Intranet)</Url>

This is the error I get:
Error 0: Cannot process argument transformation on parameter 'feature'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "Microsoft.SharePoint.Administration.SPFeatureDefinition".

I have no issues while activating custom features, but cannot activate standard SharePoint features with the SPSD Features Extension. I use SPSD version

Please advice
May 24, 2016 at 9:04 AM
Hey Adeel.

If you look into the script you will see that
$feature = Get-SPFeature -Limit ALL | Where-Object {$_.DisplayName -eq $featureNode.Name}
will return an array, containing the definitions from both 14 and 15 hive.

To avoid this, you can add the -CompatibilityLevel parameter, like this:
$feature = Get-SPFeature -Limit ALL -CompatibilityLevel 15| Where-Object {$_.DisplayName -eq "PublishingSite"}
Now you have a single object that can be converted into a "Microsoft.SharePoint.Administration.SPFeatureDefinition"