Posts

Showing posts from September, 2014

Quick Application Logger Code

//todo: check anonymous (elevated privileges?) public class Log {      private const string LogSource = "mYsOURCE" ;      public static void WriteEntry( Exception Event)      {            string sSource = LogSource;            string sLog = "Application" ;            SPSecurity .RunWithElevatedPrivileges(() =>            {                  if (! EventLog .SourceExists(sSource))                       EventLog .CreateEventSource(sSource, sLog);                  try                  {                       EventLog .WriteEntry(sSource, Event.ToString());                  }                  catch { }            });      }      public static void WriteEntry( string

how to create taxonomyField with genesis

        [SPGENField(             ID = "{BADCE114-FB99-4F27-A777-030E336D1EFA}",             StaticName = "MMDSubject",             InternalName = "MMDSubject",             DisplayName = "$Resources:Model,Field_MMDSubject_DisplayName;",             CustomType = "TaxonomyFieldType",             Group = "$Resources:Model,FieldGroup_Title;")]         public class MMDSubject : SPGENField<MMDSubject, TaxonomyField, TaxonomyFieldValue>         {             protected override void OnProvisionFinalized(TaxonomyField field, SPFieldCollection fieldCollection, bool isParentList, bool updatedOnly)             {                 SPSite site = fieldCollection.Web.Site;                 SPWeb rootWeb = site.RootWeb;                 TaxonomySession session = new TaxonomySession(site);                 TermStore termStore = session.TermStores["MMD"];                 Group group_TaxTest = termStore.Groups["Roo