2

SharePoint 2010 機能のプロパティの更新に問題があります

これは私のコードです:

using (SPSite site = new SPSite("http://vm-pc:2000"))
        {
            foreach (SPFeatureDefinition def in SPFarm.Local.FeatureDefinitions)
            {

                if (def.Scope == SPFeatureScope.WebApplication)
                {
                    if (def.GetTitle(System.Threading.Thread.CurrentThread.CurrentCulture) == "Configure Site Settings")
                    {
                        ((SPFeatureProperty)def.Properties[0]).Value = "5";
                        def.Properties.Update();
                        def.Update();

                    }
                }
            }
        }

問題はdef.Properties.Update();

例外がスローされます:

機能定義のプロパティの更新はサポートされていません。

4

1 に答える 1

0

プロパティバッグを使用しないのはなぜですか?

SPSite site = new SPSite("URL"); 
SPWeb web = site.RootWeb; 
web.Properties.Add("Key", "Value"); 
web.Properties.Update();

そして価値を得る:

web.AllProperties["Key"]
于 2012-12-06T16:28:22.427 に答える