Tuesday, September 23, 2014

Access Denied: Activate Site Collection feature

Context: I deployed a SharePoint solution via PS using Add-SPSolution and Install-SPSolution cmdlets. Once the solution was deployed, I navigated to the site collection for activating site collection feature (Site Settings -> Site Collection features). When I clicked on the respective feature for activating it, I got an error saying that Error: Access Denied. It was strange because I had the necessary right.

Solution: The solution I came up with is to activate the site collection feature by PowerShell (PS). So I wrote the following script;

$mySite = Get-SPSite http://sharepointsite.com
Enable-SPFeature -Identity "Feature Name" -Url $mySite.Url
$mySite.Dispose()


Once I executed the above command, a new error occurred saying that “The Feature is not a Farm Level Feature and is not found in a Site level defined by the Url http://sharepointsite.com”.
In order to solve this issue, I decided to execute the above command(Enable-SPFeature) by providing the feature id. As we know .wsp is a cab file so I decided to extract .wsp in order to get feature.xml file. From their, I got the feature id of the respective feature and executed the command by providing feature id without double quotes. It executed flawlessly and my webpart was ready to be used in the site. Here is the following command that I used;

Enable-SPFeature -Identity  22224bdf-0raa-4a7a-b96e-5b2fd65e3604  -Url $mySite.Url


Cheers… J..I hope it helps.

No comments:

Post a Comment