本文整理汇总了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();
}
}
}
}
示例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 { }
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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>();
}
示例11: FeatureUninstalling
public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
this.RemovePersistedObject();
});
}
示例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;
}
}
示例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();
}
}
示例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();
}
示例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();
}