Skip to main content

Site collection Feature Activation using CSOM Code.

Site collection Feature Activation using CSOM Code.

   public static void ActivateFeature(string webFullUrl, Guid featureId, bool force, FeatureDefinitionScope featdefScope)
        {
            try
            {
                using (var ctx = new ClientContext(webFullUrl))
                {
                    var features = ctx.Site.Features;
                    ctx.Load(features);
                    ctx.ExecuteQuery();

                    features.Add(featureId, force, featdefScope);
                    ctx.ExecuteQuery();
                }
                Console.WriteLine("Feature Activated.");

            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message );
            }
         
        }

Comments

Popular posts from this blog

SharePoint Farm Installation

Windows Cluster : http://technet.microsoft.com/en-us/library/bb727114.aspx http://blogs.msdn.com/b/clustering/archive/2008/01/18/7151154.aspx SQL Cluster : http://clusteringformeremortals.com/2009/10/07/step-by-step-configuring-a-2-node-multi-site-cluster-on-windows-server-2008-r2-%E2%80%93-part-3/ Network Load Balancing http://www.jppinto.com/2009/05/install-and-configure-wlbs-nlb-on-windows-server-2008/ SharePoint 2010 Farm Installation http://www.khamis.net/blog/Lists/Posts/Post.aspx?ID=48