SharePoint激活feature

SharePoint激活feature  

2010-01-08 17:34:08|  分类: SharePoint |举报|字号 订阅
    
  下载LOFTER我的照片书  |
 

        public static void ActiveFeature(SPWeb web)
        {
            try
            {
                Guid featureID;

                 featureID = new Guid("E503C941-A831-492f-9A27-1DFA7E96D818");

                SPFeature eventFeature = web.Features[featureID];
                if (eventFeature == null)
                {
                    bool allowUnsafeUpdate = web.AllowUnsafeUpdates;
                    web.AllowUnsafeUpdates = true;
                    web.Features.Add(featureID, true);
                    web.Update();
                    web.AllowUnsafeUpdates = allowUnsafeUpdate;
                }
            }
            catch (Exception e)
            {
            }
        }

阅读(927)| 评论(2)

 

posted @ 2017-11-13 09:01  sky20080101  阅读(187)  评论(0编辑  收藏  举报