We have a situation that we have to enable a site collection feature from Client Object Model (OM) instead of server side API. We run into the error when feature is been activated. Here is the summary to reproduce the issue.
After setting up SharePoint 2010 Client Object Model Console Application with 64 bit platform and .Net 3.5, we run into the error when feature is been activated.
Here is the Error Message: Feature with Id '859d22a7-0c7b-476e-afd4-420fd2955260' is not installed in this farm, and cannot be added to this scope.
Unhandled Exception: Microsoft.SharePoint.Client.ServerException: Feature with Id '859d22a7-0c7b-476e-afd4-420fd2955260' is not installed in this farm, and cannot be added to this scope.
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at ClientOM.Program.Main(String args) in E:\Harry\DEV\Student\ClientOM\ClientOM\Program.cs:line 28
Here is the source code:
static void Main(string args)
// Get the client context
using (ClientContext clientContext = new ClientContext("http://sbx01/sites/Harry/"))
// Load the features
Site clientSite = clientContext.Site;
FeatureCollection clientSiteFeatures = clientSite.Features;
Guid FeatureId = new Guid("859d22a7-0c7b-476e-afd4-420fd2955260");
// Activate the feature
clientSiteFeatures.Add(FeatureId, false, FeatureDefinitionScope.Site);
We can activate the feature through the UI and Powershell on the same server running the code. In addition, We can use the same code to deactivate the feature by commenting out the add method and uncommenting the remove method. Someone has also raised similar issue here.
We also noticed another similar code but have not test it. Many people also reported the same issue here.
We are wondered how can a site or web feature be activated using the Client Object Model?
Please let me know if you have solution. Thanks.