I recently wrote a custom SharePoint timer job and had no problem deploying it to my development environment using Visual Studio. But when I deployed to my production server and then tried to activate the feature through the site collection user interface, it failed with an “access denied” error.
I’ve run into this same issue multiple times in the last few months, and I finally got smart and decided to blog about it so I’m not having to search for the solution every time.
The solution is to activate the feature using PowerShell instead of the SharePoint UI (you may have to open your SharePoint Management Shell as Administrator).
Enable-SPFeature -Identity [Feature Display Name] -Url [Site collection URL]
If you don’t know what your feature’s display name is, there is a command for that:
Uh-oh, I can’t see the entire feature name because it’s too long. Luckily you can format it so that each property is on one line, like this:
Get-SPFeature [guid] | Format-List
Now you can see your entire feature name!
If you don’t know what your feature’s GUID is, you can get this from your project in Visual Studio (remember this is a custom developed solution):
Double click your feature name in the Solution Explorer -> Click on Manifest -> Scroll over until you find the ID attribute. This is your GUID.