【问题标题】:feature versioning in sharepointsharepoint 中的功能版本控制
【发布时间】:2013-11-16 06:33:45
【问题描述】:


我已按照以下链接实施功能版本控制: http://sisharepoint.wordpress.com/2010/01/21/using-the-featureupgrading-event-to-upgrade-features-sharepoint-2010/

我是 sharepoint 的新手,要求在我的站点中显示功能的版本。有可能吗?
我无法在网站的任何地方看到该版本。我可以在 14 hive 的功能文件夹中的 feature.xml 文件中看到适当的版本。只是想知道是否也可以在 sharepoint 站点中查看每个部署的版本?如果是,那么我在哪里可以看到它?

谢谢,
普里亚

【问题讨论】:

    标签: sharepoint sharepoint-2010 sharepoint-feature


    【解决方案1】:

    如果自定义解决方案符合您的要求,那么您可以尝试以下方法来查找已激活的功能版本。

    1. 使用 SPFarm.FeatureDefinitions

    获取农场中所有激活的功能 -

    SPFeatureDefinitionCollection farmFeatures = SPFarm.Local.FeatureDefinitions;
    foreach (SPFeatureDefinition feature in farmFeatures)
    {
    ....
    }
    
    1. 查找特定功能的版本

      var spFarm = SPFarm.Local;
      System.Version version = spFarm.FeatureDefinitions["YourFeatureName"].Version;
      
    2. 使用 SPContext.Current.SiteFeatures 或 SPContext.Current.Site.Features

      var siteFeatures= SPContext.Current.SiteFeatures;
      foreach (SPFeature sf in siteFeatures)
      

      {

      变量 = sf.Definition.DisplayName;

      variable = sf.Definition.Version.ToString();
      }
      

    4 使用 SPContext.Current.WebFeatures 或 SPContext.Current.Web.Features

    var webFeatures= SPContext.Current.WebFeatures;
    
    foreach (SPFeature webFtr in webFeatures)
    {
    variable= webFtr.Definition.DisplayName;
    variable= webFtr.Definition.Version.ToString();
    }
    

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      无法在 Central Admin 或 Site Settings 中看到这一点。关键是从用户那里抽象出版本控制。用户只知道特定功能可用,而不是什么版本。我同意,无需编写自定义解决方案就能够实际查看此信息会很好。

      【讨论】:

      • 是的,如果用户可以拥有功能版本列表,那就太好了。无论如何,我必须使用自定义代码来管理它。
      猜你喜欢
      • 2011-03-24
      • 2010-11-05
      • 2021-08-31
      • 1970-01-01
      • 2018-02-01
      • 2011-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多