Guid featureId = new Guid("0af5989a-3aea-4519-8ab0-85d91abe39ff");
ClientContext clientContext = new ClientContext("http://mysite:786/");
Site clientSite = clientContext.Site;
clientContext.Load(clientSite);
FeatureCollection clientSiteFeatures = clientSite.Features;
clientContext.Load(clientSiteFeatures);
clientContext.ExecuteQuery();
// Activate the feature
clientSite.Features.Add(featureId, true, FeatureDefinitionScope.Site);
//clientSiteFeatures.Remove(featureId, false);
clientContext.ExecuteQuery();
MessageBox.Show("Success");
当我运行此代码时,出现异常:具有
场中未安装ID“0af5989a-3aea-4519-8ab0-85d91abe39ff”,
无法添加到范围。
我从http://social.technet.microsoft.com/wiki/contents/articles/7695.list-of-sharepoint-2010-features-id-displayname-and-scopes.aspx链接获得了此功能ID
请指导。
问候,
Vikrant Raj Behal
最佳答案
FeatureDefinitionScope.None
这为我激活了网络范围的功能。
关于sharepoint - 无法在SharePoint 2010中使用COM激活功能,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17803291/