Beispiel #1
0
        /// <summary>Used to populate the list of Farm Feature Definitions</summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoadFDefs_Click(object sender, EventArgs e)
        {
            using (WaitCursor wait = new WaitCursor())
            {
                this.clbFeatureDefinitions.Items.Clear();

                farmFeatureDefinitionsManager = new FeatureManager("Farm FeatureDefinitions");
                farmFeatureDefinitionsManager.AddFeatures(SPFarm.Local.FeatureDefinitions);
                farmFeatureDefinitionsManager.Features.Sort();

                // Display any errors enumerating exceptions
                foreach (Feature feature in farmFeatureDefinitionsManager.Features)
                {
                    if (!string.IsNullOrEmpty(feature.ExceptionMsg))
                    {
                        logDateMsg("Exception reading feature " + feature.Id + ": " + feature.ExceptionMsg);
                    }
                }

                //clbFeatureDefinitions.
                this.clbFeatureDefinitions.Items.AddRange(farmFeatureDefinitionsManager.Features.ToArray());
                string featlist = BuildFeatureLog(farmFeatureDefinitionsManager.Url, farmFeatureDefinitionsManager.Features);
                logTxt(featlist);

                logDateMsg("Feature Definition list updated.");
            }
            // tabControl1.Enabled = false;
            // tabControl1.Visible = false;
            // listFeatures.Items.Clear();
            // listDetails.Items.Clear();
        }
Beispiel #2
0
        /// <summary>gets all the features from the selected Web Site and Site Collection</summary>
        private void getFeatures()
        {
            using (WaitCursor wait = new WaitCursor())
            {
                ClearLog();
                clbSPSiteFeatures.Items.Clear();
                clbSPWebFeatures.Items.Clear();

                //using (SPSite site = new SPSite(txtUrl.Text))
                using (SPSite site = m_CurrentSite)
                {
                    siteFeatureManager = new FeatureManager(site.Url);
                    siteFeatureManager.AddFeatures(site.Features, SPFeatureScope.Site);

                    //using (SPWeb web = site.OpenWeb())
                    using (SPWeb web = m_CurrentWeb)
                    {
                        webFeatureManager = new FeatureManager(web.Url);
                        webFeatureManager.AddFeatures(web.Features, SPFeatureScope.Web);
                    }
                }

                // sort the features list
                siteFeatureManager.Features.Sort();
                clbSPSiteFeatures.Items.AddRange(siteFeatureManager.Features.ToArray());
                string featlist = BuildFeatureLog(siteFeatureManager.Url, siteFeatureManager.Features);
                logTxt(featlist);

                // sort the features list
                webFeatureManager.Features.Sort();
                clbSPWebFeatures.Items.AddRange(webFeatureManager.Features.ToArray());
                featlist = BuildFeatureLog(webFeatureManager.Url, webFeatureManager.Features);
                logTxt(featlist);

                // enables the removal buttons
                // removeBtnEnabled(true);
            }
            // commented out, was too annoying
            // MessageBox.Show("Done.");
            logDateMsg("Feature list updated.");
        }