public static void RemoveCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName) { string strKey = Utility.BuildKey <T>(featureName); listItem.Properties.Remove(strKey); listItem.SystemUpdate(); }
public SPDiagnosticsCategory this[AIAPortalFeatures id] { get { return Areas[DiagnosticsAreaName].Categories[(uint)id]; } }
public static T GetCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName, bool lookupInParent) { string strKey = Utility.BuildKey <T>(featureName); string settingsXml = listItem.GetCustomProperty(strKey); //CCIUtility.LogError(settingsXml, CCIappFeatureNames.CCIappEEC); if (!string.IsNullOrEmpty(settingsXml)) { return((T)SerializationHelper.DeserializeFromXml <T>(settingsXml)); } if (!lookupInParent) { return(default(T)); } T objReturn = default(T); if (listItem.ContentType != null) { objReturn = listItem.ContentType.GetCustomSettings <T>(featureName); } return(objReturn); }
public static void SetCustomSettings <T>(this SPList list, AIAPortalFeatures featureName, T settingsObject) { string strKey = Utility.BuildKey <T>(featureName); string settingsXml = SerializationHelper.SerializeToXml <T>(settingsObject); list.SetCustomProperty(strKey, settingsXml); }
public static T GetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName, bool lookupInParent) { string strKey = Utility.BuildKey <T>(featureName); string settingsXml = contentType.XmlDocuments[strKey]; if (!string.IsNullOrEmpty(settingsXml)) { return((T)SerializationHelper.DeserializeFromXml <T>(settingsXml, strKey)); } if (!lookupInParent) { return(default(T)); } T objReturn = default(T); if (contentType.Parent.Sealed == false) { objReturn = contentType.Parent.GetCustomSettings <T>(featureName); } if (objReturn == null && contentType.ParentList != null) { objReturn = contentType.ParentList.GetCustomSettings <T>(featureName); } if (objReturn == null && contentType.ParentWeb != null) { objReturn = contentType.ParentWeb.GetCustomSettings <T>(featureName); } return(objReturn); }
public SPDiagnosticsCategory this[AIAPortalFeatures id] { get { return(Areas[DiagnosticsAreaName].Categories[(uint)id]); } }
public static void SetCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName, T settingsObject) { string strKey = Utility.BuildKey <T>(featureName); string settingsXml = SerializationHelper.SerializeToXml <T>(settingsObject); //CCIUtility.LogError(settingsXml, CCIappFeatureNames.CCIappEEC); listItem.SetCustomProperty(strKey, settingsXml); }
public static void RemoveCustomSettings <T>(this SPWeb web, AIAPortalFeatures featureName) { string strKey = Utility.BuildKey <T>(featureName); //web.Properties.Remove(strKey); web.Properties[strKey] = null; web.Update(); web.Properties.Update(); }
public static void RemoveCustomSettings <T>(this SPList list, AIAPortalFeatures featureName) { string strKey = Utility.BuildKey <T>(featureName); SPFolder rootFolder = list.RootFolder; rootFolder.Properties.Remove(strKey); rootFolder.Update(); }
protected override IEnumerable <SPDiagnosticsArea> ProvideAreas() { List <SPDiagnosticsCategory> categories = new List <SPDiagnosticsCategory>(); foreach (string catName in Enum.GetNames(typeof(AIAPortalFeatures))) { AIAPortalFeatures entry = ( AIAPortalFeatures)Enum.Parse(typeof(AIAPortalFeatures), catName); uint catId = (uint)(int)Enum.Parse(typeof(AIAPortalFeatures), catName); string friendlyname = GetDescription(entry); categories.Add(new SPDiagnosticsCategory(friendlyname, TraceSeverity.Verbose, EventSeverity.Error, 0, catId)); } yield return(new SPDiagnosticsArea(DiagnosticsAreaName, categories)); }
public static void LogInfo(string errorMessage, AIAPortalFeatures category) { try { DiagnosticsService myULS = DiagnosticsService.Local; if (myULS != null) { SPDiagnosticsCategory cat = myULS[category]; string format = errorMessage; //myULS.WriteTrace(1, cat, TraceSeverity.Medium, format, myULS.TypeName); myULS.Information(cat, errorMessage); } } catch {} }
public static void LogInfo(string errorMessage, string category) { //Log(errorMessage, TraceProvider.TraceSeverity.InformationEvent, category); AIAPortalFeatures e = AIAPortalFeatures.Infrastructure; try { e = (AIAPortalFeatures)Enum.Parse(typeof(AIAPortalFeatures), category); } catch {}; LogInfo(errorMessage, e); //SPTraceLogger logger = new SPTraceLogger(); //logger.Write(0, SPTraceLogger.TraceSeverity.InformationEvent, "AIA.Intranet TraceProvider", "AIA.Intranet", category, errorMessage); }
public static T GetCustomSettings <T>(this SPList list, AIAPortalFeatures featureName, bool lookupInParent) { string strKey = Utility.BuildKey <T>(featureName); string settingsXml = list.GetCustomProperty(strKey); if (!string.IsNullOrEmpty(settingsXml)) { return((T)SerializationHelper.DeserializeFromXml <T>(settingsXml)); } if (lookupInParent && string.IsNullOrEmpty(settingsXml) && list.ParentWeb != null) { return(list.ParentWeb.GetCustomSettings <T>(featureName)); } return(default(T)); }
public static void LogError(string errorMessage, AIAPortalFeatures category) { try { DiagnosticsService myULS = DiagnosticsService.Local; if (myULS != null) { //SPDiagnosticsCategory cat = myULS[CategoryId.DocuSignService]; SPDiagnosticsCategory cat = myULS[category]; string format = errorMessage; myULS.WriteTrace(1, cat, TraceSeverity.Unexpected, format, myULS.TypeName); } } catch (Exception) { } //Log(errorMessage, TraceProvider.TraceSeverity.CriticalEvent, category); //SPTraceLogger logger = new SPTraceLogger(); //logger.Write(0, SPTraceLogger.TraceSeverity.Exception,"AIA.Intranet TraceProvider", "AIA.Intranet", category, errorMessage); }
public static void SetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName, T settingsObject, bool applyToChilds) { string strKey = Utility.BuildKey <T>(featureName); string settingsXml = SerializationHelper.SerializeToXml <T>(settingsObject, strKey); SPXmlDocumentCollection xmlDocCollection = contentType.XmlDocuments; if (!string.IsNullOrEmpty(xmlDocCollection[strKey])) { xmlDocCollection.Delete(strKey); } XmlDocument customXmlDocSettings = new XmlDocument(); customXmlDocSettings.LoadXml(settingsXml); xmlDocCollection.Add(customXmlDocSettings); //try //{ SPSecurity.RunWithElevatedPrivileges(delegate() { contentType.ParentWeb.AllowUnsafeUpdates = true; contentType.XmlDocuments.Delete("http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url"); if (contentType.ParentList == null) { contentType.Update(applyToChilds, false); } else { contentType.Update(); } contentType.ParentWeb.AllowUnsafeUpdates = false; }); //} //catch //{ // CCIUtility.LogInfo("Do not throw message if using option apply to child but current content type doen't have any child", "AIA.Intranet.Common"); //} }
public static T GetCustomSettings <T>(this SPList list, AIAPortalFeatures featureName) { return(list.GetCustomSettings <T>(featureName, true)); }
public static T GetCustomSettings <T>(this SPWeb web, AIAPortalFeatures featureName) { return(web.GetCustomSettings <T>(featureName, true)); }
public static void RemoveCustomSettings <T>(this SPContentType ctype, AIAPortalFeatures featureName, bool applyToChilds) { ctype.SetCustomSettings <T>(featureName, default(T), applyToChilds); }
public static void RemoveCustomSettings <T>(this SPContentType ctype, AIAPortalFeatures featureName) { ctype.SetCustomSettings <T>(featureName, default(T)); }
public static void SetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName, T settingsObject) { contentType.SetCustomSettings <T>(featureName, settingsObject, false); }
public static T GetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName) { return(contentType.GetCustomSettings <T>(featureName, true)); }
public static string BuildKey <T>(AIAPortalFeatures featureName) { return(featureName.ToString() + typeof(T).ToString()); }