Skip to content

Commit

Permalink
Log WARN when no Outlook category mapping found as specified in Setti…
Browse files Browse the repository at this point in the history
…ngs.

Refresh Categories if null.
Closes #1031
  • Loading branch information
phw198 committed Jul 19, 2020
1 parent 69ab73d commit cf06337
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,6 @@ private void getOutlookCategoryColour(String aiCategories, ref OlCategoryColor?
try {
String category = aiCategories.Split(new[] { OutlookOgcs.Calendar.Categories.Delimiter }, StringSplitOptions.None).FirstOrDefault();
categoryColour = OutlookOgcs.Calendar.Categories.OutlookColour(category);
if (categoryColour == null) log.Warn("Could not convert category name '" + category + "' into Outlook category type.");
} catch (System.Exception ex) {
log.Error("Failed determining colour for Event from AppointmentItem categories: " + aiCategories);
OGCSexception.Analyse(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,15 @@ public void BuildPicker(ref System.Windows.Forms.CheckedListBox clb) {
/// <returns>The Outlook category type</returns>
public Outlook.OlCategoryColor? OutlookColour(String categoryName) {
if (string.IsNullOrEmpty(categoryName)) log.Warn("Category name is empty.");

if (this.categories == null)
OutlookOgcs.Calendar.Instance.IOutlook.RefreshCategories();

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;
}

Expand Down

0 comments on commit cf06337

Please sign in to comment.