当前位置: 首页>>代码示例>>C#>>正文


C# SPFeatureReceiverProperties类代码示例

本文整理汇总了C#中SPFeatureReceiverProperties的典型用法代码示例。如果您正苦于以下问题:C# SPFeatureReceiverProperties类的具体用法?C# SPFeatureReceiverProperties怎么用?C# SPFeatureReceiverProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SPFeatureReceiverProperties类属于命名空间,在下文中一共展示了SPFeatureReceiverProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FeatureDeactivating

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            string assembly = "ExternalListEvents, Culture=neutral, Version=1.0.0.0, PublicKeyToken=f3e998418ec415ce";

            using (SPSite siteCollection = new SPSite("http://dev.wingtip13.com/bcs"))
            {
                using (SPWeb site = siteCollection.OpenWeb())
                {
                    SPList customers = site.Lists["Customers"];
                    SPEventReceiverDefinitionCollection receivers = customers.EventReceivers;
                    SPEventReceiverDefinition activityReceiver = null;
                    foreach (SPEventReceiverDefinition receiver in receivers)
                    {
                        if (receiver.Assembly.Equals(assembly, StringComparison.OrdinalIgnoreCase))
                        {
                            activityReceiver = receiver;
                            break;
                        }
                    }

                    if (activityReceiver != null)
                    {
                        activityReceiver.Delete();
                    }

                }
            }
        }
开发者ID:zohaib01khan,项目名称:Sharepoint-training-for-Learning,代码行数:28,代码来源:Feature1.EventReceiver.cs

示例2: FeatureDeactivating

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            try
            {
                SPWebApplication webApp = null;

                if (properties.Feature.Parent is SPSite)
                {
                    SPSite spSite = properties.Feature.Parent as SPSite;
                    webApp = spSite.WebApplication;
                }
                else if (properties.Feature.Parent is SPWebApplication)
                {
                    webApp = properties.Feature.Parent as SPWebApplication;
                }

                String pathToCompatBrowser = webApp.IisSettings[SPUrlZone.Default].Path + @"\App_Browsers\compat.browser";

                XElement compatBrowser = XElement.Load(pathToCompatBrowser);

                XElement mobileAdapter = compatBrowser.XPathSelectElement(String.Format("./browser[@refID = \"default\"]/controlAdapters/adapter[@controlType = \"{0}\"]", controlType));
                mobileAdapter.Remove();

                // Overwrite the old version of compat.browser with your new version.
                compatBrowser.Save(pathToCompatBrowser);
            }
            catch { }
        }
开发者ID:ricardocarneiro,项目名称:wet-boew-sharepoint,代码行数:28,代码来源:AttachAdapter.EventReceiver.cs

示例3: FeatureDeactivating

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            var configManager = SharePointServiceLocator.GetCurrent().GetInstance<IConfigManager>();
            var configuredAreas = new DiagnosticsAreaCollection(configManager);

            foreach (var area in Areas)
            {
                var areaToRemove = configuredAreas[area.Name];

                if (areaToRemove != null)
                {
                    foreach (var c in area.DiagnosticsCategories)
                    {
                        var existingCat = areaToRemove.DiagnosticsCategories[c.Name];
                        if (existingCat != null)
                        {
                            areaToRemove.DiagnosticsCategories.Remove(existingCat);
                        }
                    }

                    if (areaToRemove.DiagnosticsCategories.Count == 0)
                    {
                        configuredAreas.Remove(areaToRemove);
                    }
                }
            }

            configuredAreas.SaveConfiguration();
        }
开发者ID:ivankozyrev,项目名称:fls-internal-portal,代码行数:29,代码来源:Logger.EventReceiver.cs

示例4: FeatureActivated

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var webApp = properties.Feature.Parent as SPWebApplication;
            if (webApp == null) throw new Exception("webApp");

            // undeploy the job if already registered
            var ej = from SPJobDefinition job in webApp.JobDefinitions
                     where job.Name == FileLoader.JOB_DEFINITION_NAME
                     select job;

            if (ej.Count() > 0)
                ej.First().Delete();

            // create and configure timerjob
            var schedule = new SPMinuteSchedule
                {
                    BeginSecond = 0,
                    EndSecond = 59,
                    Interval = 55,
                };
            var myJob = new FileLoader(webApp)
                {
                    Schedule = schedule,
                    IsDisabled = false
                };

            // save the timer job deployment
            myJob.Update();
        }
开发者ID:mareanoben,项目名称:Enogex,代码行数:29,代码来源:Feature1.EventReceiver.cs

示例5: FeatureActivated

        /// <summary>
        /// Creates fields for the navigation module
        /// </summary>
        /// <param name="properties">The event properties</param>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var site = properties.Feature.Parent as SPSite;

            if (site != null)
            {
                using (var featureScope = NavigationContainerProxy.BeginFeatureLifetimeScope(properties.Feature))
                {
                    var fieldHelper = featureScope.Resolve<IFieldHelper>();
                    var baseFieldInfoConfig = featureScope.Resolve<INavigationFieldInfoConfig>();
                    var baseFields = baseFieldInfoConfig.Fields;
                    var logger = featureScope.Resolve<ILogger>();

                    using (new Unsafe(site.RootWeb))
                    {
                        // Create fields
                        foreach (BaseFieldInfo field in baseFields)
                        {
                            logger.Info("Creating field {0}", field.InternalName);
                            fieldHelper.EnsureField(site.RootWeb.Fields, field);
                        }
                    }
                }
            }
        }
开发者ID:GSoft-SharePoint,项目名称:Dynamite-Components,代码行数:29,代码来源:CrossSitePublishingCMS_Fields.EventReceiver.cs

示例6: FeatureDeactivating

 public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
 {
     var serviceLocator = SharePointServiceLocator.GetCurrent();
     var typeMappings = serviceLocator.GetInstance<IServiceLocatorConfig>();
     typeMappings.RemoveTypeMapping<IConfigPropertiesParser>(null);
     typeMappings.RemoveTypeMapping<IFileSystemHelper>(null);
 }
开发者ID:ivankozyrev,项目名称:fls-internal-portal,代码行数:7,代码来源:ServiceLocator.EventReceiver.cs

示例7: FeatureActivated

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            using (SPSite curSite = (SPSite)properties.Feature.Parent)
            {

                using (SPWeb curWeb = curSite.RootWeb)
                {
                    Uri masterUri = new Uri(curWeb.Url + "/_catalogs/masterpage/KapschMaster-archive.master");

                    MasterUrl = masterUri.AbsolutePath;
                    CustomMasterUrl = masterUri.AbsolutePath;

                    curWeb.MasterUrl = MasterUrl;
                    curWeb.CustomMasterUrl = CustomMasterUrl;
                    curWeb.Update();

                    SPWebCollection webCol = curWeb.Webs;
                    foreach (SPWeb childWeb in webCol)
                    {
                        UpdateMasterPageofWebs(childWeb);

                    }

                }
            }
        }
开发者ID:iohn2000,项目名称:gsa-custom-searchbox.spmaster,代码行数:26,代码来源:Archive.EventReceiver.cs

示例8: FeatureDeactivating

        // Uncomment the method below to handle the event raised before a feature is deactivated.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {

            using (SPSite curSite = (SPSite)properties.Feature.Parent)
            {
                using (SPWeb curWeb = curSite.RootWeb)
                {
                    Uri masterUri = new Uri(curWeb.Url + "/_catalogs/masterpage/v4.master");

                    MasterUrl = masterUri.AbsolutePath;
                    CustomMasterUrl = masterUri.AbsolutePath;

                    curWeb.MasterUrl = MasterUrl;
                    curWeb.CustomMasterUrl = CustomMasterUrl;
                    curWeb.Update();

                    foreach (SPWeb subWeb in curWeb.Webs)
                    {
                        UpdateMasterPageofWebs(subWeb);
                       
                    }
                }
            }

        }
开发者ID:iohn2000,项目名称:gsa-custom-searchbox.spmaster,代码行数:27,代码来源:Internal.EventReceiver.cs

示例9: FeatureActivated

        /// <summary>
        /// Configures only the content pages catalog to allow the open term creation in the navigation column
        /// </summary>
        /// <param name="properties">Context properties</param>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var web = properties.Feature.Parent as SPWeb;

            if (web != null)
            {
                using (var featureScope = NavigationContainerProxy.BeginFeatureLifetimeScope(properties.Feature))
                {
                    var listHelper = featureScope.Resolve<IListHelper>();
                    var listConfig = featureScope.Resolve<INavigationListInfosConfig>().Lists;
                    var logger = featureScope.Resolve<ILogger>();

                    // Add only the target content pages list
                    var contentPages = listConfig.FirstOrDefault(p => p.WebRelativeUrl.ToString().Equals("Pages"));

                    if (contentPages != null)
                    {
                        listConfig.Clear();
                        listConfig.Add(contentPages);

                        // Create lists
                        foreach (var list in listConfig)
                        {
                            logger.Info("Configuring list {0} in web {1}", list.WebRelativeUrl, web.Url);
                            listHelper.EnsureList(web, list);
                        }
                    }
                    else
                    {
                        logger.Info("No content pages list information found in the configuration. Please add the content pages list configuration to use this feature");
                    }
                }
            }
        }
开发者ID:GSoft-SharePoint,项目名称:Dynamite-Components,代码行数:38,代码来源:CrossSitePublishingCMS_ContentPagesList.EventReceiver.cs

示例10: FeatureActivated

        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            ServiceLocatorConfig serviceLocatorConfig = new ServiceLocatorConfig();
            serviceLocatorConfig.RegisterTypeMapping<IIssueManagementRepository, IssueManagementRepository>();


        }
开发者ID:lazda,项目名称:collabode,代码行数:9,代码来源:Services.EventReceiver.cs

示例11: FeatureUninstalling

 public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
 {
     SPSecurity.RunWithElevatedPrivileges(delegate()
     {
         this.RemovePersistedObject();
     });
 }
开发者ID:Yvand,项目名称:AzureCP,代码行数:7,代码来源:AzureCP.EventReceiver.cs

示例12: FeatureActivated

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            char[] slashes = { '/' };
            string _masterPagePath = string.Empty;
            try
            {
                SPSite ObjSite = properties.Feature.Parent as SPSite;

                //Getting the master page file path.
                SPFeatureProperty masterFile = properties.Definition.Properties[MASTERPAGEFILE];

                //Getting Site Ref
                foreach (SPWeb ObjWeb in ObjSite.AllWebs)
                {
                    if (ObjWeb.IsRootWeb)
                    {
                        _masterPagePath=ObjWeb.ServerRelativeUrl.TrimEnd(slashes) + "/_catalogs/masterpage/" + masterFile.Value;
                    }
                    //Updating master pages for all sites;
                    ObjWeb.CustomMasterUrl = _masterPagePath;
                    ObjWeb.MasterUrl = _masterPagePath;
                    ObjWeb.ApplyTheme("simple");
                    ObjWeb.Update();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:infinitimods,项目名称:clif-sharepoint,代码行数:30,代码来源:Worker.cs

示例13: FeatureDeactivating

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            var site = properties.Feature.Parent as SPSite;
            SPWeb web = site.RootWeb;
            try
            {                
                RemoveEventReceivers(web);

                // http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges(v=office.14).aspx
                SPSecurity.RunWithElevatedPrivileges(() =>
                {
                    using (var epsite = new SPSite(site.ID))
                    {
                        RemoveCleanupTimerJob(epsite.WebApplication);
                    }
                });

                LogList.DeleteList(web);
            }
            catch (Exception ex)
            {
                ULSLog.LogError(ex);
            }
            finally
            {
                site.Dispose();
                web.Dispose();
            }
        }
开发者ID:egil,项目名称:SPADD,代码行数:29,代码来源:FileChangedMonitorFeature.EventReceiver.cs

示例14: FeatureDeactivating

        // フィーチャーをアクティブにした後に発生したイベントを処理するには、以下のメソッドのコメントを解除します。
        //public override void FeatureActivated(SPFeatureReceiverProperties properties)
        //{
        //    // サイト (SPWeb) またはサイトコレクション (SPSite) の SPWeb を取得します
        //    SPWeb web;
        //    if (properties.Feature.Parent is SPWeb)
        //        web = (SPWeb)properties.Feature.Parent; //サイトの場合
        //    else
        //        web = ((SPSite)properties.Feature.Parent).RootWeb; //サイトコレクションの場合
        //    web.AllowUnsafeUpdates = true;
        //    // [ページ] 内のすべてのページにマスターページを適用
        //    web.CustomMasterUrl = SPUrlUtility.CombineUrl(web.ServerRelativeUrl,
        //        "_catalogs/masterpage/MyDemoMaster/mysample.master");
        //    // システムのページ (設定画面など) にマスターページを適用
        //    web.MasterUrl = SPUrlUtility.CombineUrl(web.ServerRelativeUrl,
        //        "_catalogs/masterpage/MyDemoMaster/mysample.master");
        //    web.Update();
        //}
        // フィーチャーを非アクティブにする前に発生したイベントを処理するには、以下のメソッドのコメントを解除します。
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            // サイト (SPWeb) またはサイトコレクション (SPSite) の SPWeb を取得します
            SPWeb web;
            if (properties.Feature.Parent is SPWeb)
                web = (SPWeb)properties.Feature.Parent; //サイトの場合
            else
                web = ((SPSite)properties.Feature.Parent).RootWeb; //サイトコレクションの場合

            //web.AllowUnsafeUpdates = true;
            //// [ページ] 内のすべてのページにマスターページを適用
            //web.CustomMasterUrl = SPUrlUtility.CombineUrl(web.ServerRelativeUrl,
            //    "_catalogs/masterpage/v4.master");
            //// システムのページ (設定画面など) にマスターページを適用
            //web.MasterUrl = SPUrlUtility.CombineUrl(web.ServerRelativeUrl,
            //    "_catalogs/masterpage/v4.master");
            //web.Update();

            // カスタムリスト定義から派生されたリストをすべて削除
            List<SPList> deleteLists = new List<SPList>();
            foreach (SPList list in web.Lists)
            {
                if ((list.BaseTemplate.ToString().Equals("16301")) ||
                    (list.BaseTemplate.ToString().Equals("16302")))
                    deleteLists.Add(list);
            }
            foreach (SPList list in deleteLists)
            {
                list.Delete();
            }

            // リソース ライブラリーを削除
            if(web.Lists.TryGetList("MSKK_SandboxDemo_Resources") != null)
                web.Lists["MSKK_SandboxDemo_Resources"].Delete();
        }
开发者ID:tsmatsuz,项目名称:20110629_SharePointOnlineSample,代码行数:54,代码来源:WebFeature4.EventReceiver.cs

示例15: FeatureActivated

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            base.FeatureActivated(properties);

            SPSite site = (SPSite)properties.Feature.Parent;
            SPWeb web = site.RootWeb;
            SPList list = web.Lists["Articles"];

            //SPContentType newContentType = web.AvailableContentTypes["Article2"];
            SPContentType oldContentType = list.ContentTypes["Article"];

            oldContentType.EditFormTemplateName = "NCArticleListEditForm";
            oldContentType.NewFormTemplateName = "NCArticleListEditForm";

            list.ContentTypesEnabled = true;

            //try
            //{
            //    list.ContentTypes.Add(newContentType);
            //}
            //catch { }

            //try
            //{
            //    list.ContentTypes.Delete(oldContentType.Id);
            //}
            //catch { }

            oldContentType.Update();
            list.Update();
        }
开发者ID:MohitVash,项目名称:TestProject,代码行数:31,代码来源:NCNewssitePatch2ModifyArticlesContentTypeReceiver.cs


注:本文中的SPFeatureReceiverProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。