/// <summary> /// Get the Outlook category colour from the name given to the category /// </summary> /// <param name="categoryName">The user named Outlook category</param> /// <returns>The Outlook category type</returns> public Outlook.OlCategoryColor?OutlookColour(String categoryName) { if (string.IsNullOrEmpty(categoryName)) { log.Warn("Category name is empty."); } try { if (this.categories != null && this.categories.Count > 0) { } } catch (System.Exception ex) { OGCSexception.Analyse("Categories are not accessible!", OGCSexception.LogAsFail(ex)); this.categories = null; } if (this.categories == null || OutlookOgcs.Calendar.Categories == null) { OutlookOgcs.Calendar.Instance.IOutlook.RefreshCategories(); this.categories = Calendar.Categories.categories; } foreach (Outlook.Category category in this.categories) { if (category.Name == categoryName.Trim()) { return(category.Color); } } log.Warn("Could not convert category name '" + categoryName + "' into Outlook category type."); return(null); }
public static void AddCategory(String tagName, Outlook.Application application) { Outlook.Categories categories = application.Session.Categories; if (!CategoryExists(tagName, application)) { Outlook.Category category = categories.Add(tagName); } }
public static void EnumerateCategories() { Outlook.Categories categories = ThisAddIn.zmiennaDoSettinngs.Session.Categories; foreach (Outlook.Category category in categories) { Debug.WriteLine(category.Name); Debug.WriteLine(category.CategoryID); } }
private static void AddACategory(string categoryName, Outlook.OlCategoryColor color) { Outlook.Categories categories = ThisAddIn.zmiennaDoSettinngs.Session.Categories; if (!CategoryExists(categoryName)) { _ = categories.Add(categoryName, color); } }
private void LoadCategories() { Outlook.Categories categories = Globals.ThisAddIn.Application.Session.Categories; foreach (Outlook.Category cat in categories) { DataGridViewRow r = (DataGridViewRow)dgConfig.RowTemplate.Clone(); r.CreateCells(dgConfig); r.Cells[0].Value = cat.Name; dgConfig.Rows.Add(r); } }
private void AddACategory() { Outlook.Categories categories = Application.Session.Categories; string categorie = Localisation.getInstance().getString( Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName, "ARCHIVED_CATEGORY" ); if (!CategoryExists(categorie)) { Outlook.Category category = categories.Add(categorie, Outlook.OlCategoryColor.olCategoryColorGreen); } }
public static void EnsureCategoryExists(String tag, Outlook.Application application) { Outlook.Categories categories = application.Session.Categories; Outlook.Category match = null; foreach (Outlook.Category category in categories) { if (category.Name.Equals(tag)) { match = category; } } if (null == match) { throw new TagServicesException("Tried to add nonexistent category mailItem as per tag " + tag); } }
/// <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; } } }
public CategoryList(string xmlString, Outlook.Categories outlookCategories) { if (!string.IsNullOrWhiteSpace(xmlString)) { try { this.items = new List <Category>(DeserializeItemsFromXmlString(xmlString)); } catch (Exception) { // Ignore de-serialization issues for now. } } DecorateAndConcatOutlookCategories(this.items ?? (this.items = new List <Category>()), outlookCategories); }
private void btnParameters_Click(object sender, EventArgs e) { Outlook.Application outlookApplication = this.OutlookFormRegion.Application; Outlook.Categories categories = outlookApplication.Session.Categories; List <string> categoryList = new List <string>(); foreach (Outlook.Category category in categories) { categoryList.Add(category.Name); } ParametersForm parametersForm = new ParametersForm(); parametersForm.parmListCategory(categoryList); parametersForm.ShowDialog(); outlookApplication.ActiveExplorer().Activate(); }
/// <summary> /// Get the Outlook categories as List of ColourInfo /// </summary> /// <returns>List to be used in dropdown, for example</returns> public List <OutlookOgcs.Categories.ColourInfo> DropdownItems() { List <OutlookOgcs.Categories.ColourInfo> items = new List <OutlookOgcs.Categories.ColourInfo>(); if (this.categories == null) { OutlookOgcs.Calendar.Instance.IOutlook.RefreshCategories(); this.categories = Calendar.Categories.categories; } if (this.categories != null) { foreach (Outlook.Category category in this.categories) { items.Add(new OutlookOgcs.Categories.ColourInfo(category.Color, Categories.Map.RgbColour(category.Color), category.Name)); } } return(items.OrderBy(i => i.Text).ToList()); }
private static void AddACategory() { string[] lines = File.ReadAllLines(@"C:\CategoryList.txt"); var app = new Application(); foreach (string line in lines) { string[] LineArray = line.Split('|'); var color = LineArray[1]; Outlook.Categories categories = app.Session.Categories; //Add categories if (CategoryExists(LineArray[0], app) == false) { categories.Add(LineArray[0], color); } } }
private static void UpdateCategory(Outlook.Application app, string name, Outlook.OlCategoryColor color) { Outlook.Categories allCats = app.GetNamespace("MAPI").Categories; bool found = false; for (int i = 1; i <= allCats.Count; i++) { if (allCats[i].Name == name) { allCats[i].Color = color; found = true; break; } } if (!found) { app.GetNamespace("MAPI").Categories.Add(name, color, null); } }
private void AddACategory() { Outlook.Categories categories = Application.Session.Categories; if (!CategoryExists("Onbekend mail adress")) { Outlook.Category category = categories.Add("Onbekend mail adress", Outlook.OlCategoryColor.olCategoryColorDarkRed); } if (!CategoryExists("none")) { Outlook.Category category = categories.Add("none", Outlook.OlCategoryColor.olCategoryColorNone); } if (!CategoryExists("Automatisch gearchiveerd")) { Outlook.Category category = categories.Add("Automatisch gearchiveerd", Outlook.OlCategoryColor.olCategoryColorGreen); } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { ((Outlook.ApplicationEvents_11_Event)Application).Quit += new Outlook.ApplicationEvents_11_QuitEventHandler(ThisAddIn_Quit); inspectors = this.Application.Inspectors; currentExplorer = this.Application.ActiveExplorer(); outlookNameSpace = this.Application.GetNamespace("MAPI"); currentExplorer.SelectionChange += CurrentExplorer_SelectionChange; Application.NewMailEx += Application_NewMailEx; /* * Outlook.MAPIFolder inbox = outlookNameSpace.GetDefaultFolder( Outlook.OlDefaultFolders.olFolderInbox ); * inbox.Items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler( items_ItemAdd ); * //outlookNameSpace. */ Outlook.Categories categories = Application.Session.Categories; EmailProcessor.EmailProcessor.SetCategories(categories); job1Ribbon = Globals.Ribbons.Ribbon1; ProcessTextfiles(); StartPipe(); jobListTaskPane = new JobListTaskPane(); //jobListTaskPane.Width = 600; //jobListTaskPane.Height = 400; jobListTaskPane.Visible = true; jobListTaskPane.PipeOps = this.pipeOps; myCustomTaskPane = this.CustomTaskPanes.Add(jobListTaskPane, "Job List TaskPane"); //myCustomTaskPane.Visible = true; myCustomTaskPane.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionFloating; myCustomTaskPane.Width = 900; myCustomTaskPane.Height = 400; // }
/// <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); } }
private void InitializeCategoryGallery() { galleryCategory.Items.Clear(); Outlook.Categories categories = Globals.ThisAddIn.Application.ActiveExplorer().Session.Categories; // ensure we have a "WFM for Outlook" category to tag try { if (categories[Options.CONFIG_MESSAGE_SUBJECT] == null) { Outlook.Category wfmCategory = categories.Add(Options.CONFIG_MESSAGE_SUBJECT, Outlook.OlCategoryColor.olCategoryColorYellow); } } catch (Exception e) { MessageBox.Show($"Failed to initialize a default category: {e}"); } var dropdownItem = this.Factory.CreateRibbonDropDownItem(); dropdownItem.Label = "None"; dropdownItem.Tag = string.Empty; galleryCategory.Items.Clear(); galleryCategory.Items.Add(dropdownItem); galleryCategory.SelectedItem = dropdownItem; foreach (Outlook.Category cat in categories) { dropdownItem = this.Factory.CreateRibbonDropDownItem(); dropdownItem.Label = cat.Name; dropdownItem.Tag = cat.CategoryID; galleryCategory.Items.Add(dropdownItem); if (Globals.ThisAddIn.userOptions.categoryName == cat.Name) { galleryCategory.SelectedItem = dropdownItem; } } }
public void Dispose() { categories = (Outlook.Categories)OutlookOgcs.Calendar.ReleaseObject(categories); }