Example #1
0
 /// <summary>
 /// Get the categories as configured in Outlook and store in class
 /// </summary>
 /// <param name="oApp"></param>
 /// <param name="store"></param>
 public void Get(Outlook.Application oApp, Outlook.Store store)
 {
     if (Settings.Instance.OutlookService == OutlookOgcs.Calendar.Service.DefaultMailbox)
     {
         this.categories = oApp.Session.Categories;
     }
     else
     {
         try {
             this.categories = store.GetType().GetProperty("Categories").GetValue(store, null) as Outlook.Categories;
         } catch (System.Exception ex) {
             OGCSexception.Analyse(ex, true);
             this.categories = oApp.Session.Categories;
         }
     }
 }
 /// <summary>
 /// Get the categories as configured in Outlook and store in class
 /// </summary>
 /// <param name="oApp"></param>
 /// <param name="calendar"></param>
 public void Get(Outlook.Application oApp, Outlook.MAPIFolder calendar)
 {
     Outlook.Store store = null;
     try {
         if (Settings.Instance.OutlookService == OutlookOgcs.Calendar.Service.DefaultMailbox)
         {
             this.categories = oApp.Session.Categories;
         }
         else
         {
             try {
                 store           = calendar.Store;
                 this.categories = store.GetType().GetProperty("Categories").GetValue(store, null) as Outlook.Categories;
             } catch (System.Exception ex) {
                 log.Warn("Failed getting non-default mailbox categories. " + ex.Message);
                 log.Debug("Reverting to default mailbox categories.");
                 this.categories = oApp.Session.Categories;
             }
         }
     } finally {
         store = (Outlook.Store)Calendar.ReleaseObject(store);
     }
 }