/// <remarks> /// InitializeData has to set fields instead of properties, since properties can interfer with each other! /// </remarks> private void InitializeData(EventMappingConfiguration mappingConfiguration) { _categoryShortcutKey = mappingConfiguration.CategoryShortcutKey; _createEventsInUtc = mappingConfiguration.CreateEventsInUTC; _useIanaTz = mappingConfiguration.UseIanaTz; _eventTz = mappingConfiguration.EventTz; _includeHistoricalData = mappingConfiguration.IncludeHistoricalData; _useGlobalAppointmentId = mappingConfiguration.UseGlobalAppointmentID; _eventCategory = mappingConfiguration.EventCategory; _eventCategoryColor = mappingConfiguration.EventCategoryColor; _includeEmptyEventCategoryFilter = mappingConfiguration.IncludeEmptyEventCategoryFilter; _invertEventCategoryFilter = mappingConfiguration.InvertEventCategoryFilter; _mapAttendees = mappingConfiguration.MapAttendees; _mapBody = mappingConfiguration.MapBody; _mapRtfBodyToXAltDesc = mappingConfiguration.MapRtfBodyToXAltDesc; _mapXAltDescToRtfBody = mappingConfiguration.MapXAltDescToRtfBody; _mapClassConfidentialToSensitivityPrivate = mappingConfiguration.MapClassConfidentialToSensitivityPrivate; _mapClassPublicToSensitivityPrivate = mappingConfiguration.MapClassPublicToSensitivityPrivate; _mapReminder = mappingConfiguration.MapReminder; _mapSensitivityPrivateToClassConfidential = mappingConfiguration.MapSensitivityPrivateToClassConfidential; _scheduleAgentClient = mappingConfiguration.ScheduleAgentClient; _sendNoAppointmentNotifications = mappingConfiguration.SendNoAppointmentNotifications; _useEventCategoryColorAndMapFromCalendarColor = mappingConfiguration.UseEventCategoryColorAndMapFromCalendarColor; _cleanupDuplicateEvents = mappingConfiguration.CleanupDuplicateEvents; _mapCustomProperties = mappingConfiguration.MapCustomProperties; if (mappingConfiguration.UserDefinedCustomPropertyMappings != null) { Array.ForEach(mappingConfiguration.UserDefinedCustomPropertyMappings, m => Mappings.Add(new PropertyMappingModel(m))); } }
/// <remarks> /// InitializeData has to set fields instead of properties, since properties can interfer with each other! /// </remarks> private void InitializeData(EventMappingConfiguration mappingConfiguration) { _createEventsInUtc = mappingConfiguration.CreateEventsInUTC; _useIanaTz = mappingConfiguration.UseIanaTz; _eventTz = mappingConfiguration.EventTz; _includeHistoricalData = mappingConfiguration.IncludeHistoricalData; _useGlobalAppointmentId = mappingConfiguration.UseGlobalAppointmentID; _eventCategory = mappingConfiguration.EventCategory; _includeEmptyEventCategoryFilter = mappingConfiguration.IncludeEmptyEventCategoryFilter; _invertEventCategoryFilter = mappingConfiguration.InvertEventCategoryFilter; _mapAttendees = mappingConfiguration.MapAttendees; _mapBody = mappingConfiguration.MapBody; _mapRtfBodyToXAltDesc = mappingConfiguration.MapRtfBodyToXAltDesc; _mapXAltDescToRtfBody = mappingConfiguration.MapXAltDescToRtfBody; _mapClassConfidentialToSensitivityPrivate = mappingConfiguration.MapClassConfidentialToSensitivityPrivate; _mapClassPublicToSensitivityPrivate = mappingConfiguration.MapClassPublicToSensitivityPrivate; _mapReminder = mappingConfiguration.MapReminder; _mapSensitivityPrivateToClassConfidential = mappingConfiguration.MapSensitivityPrivateToClassConfidential; _mapSensitivityPublicToDefault = mappingConfiguration.MapSensitivityPublicToDefault; _scheduleAgentClient = mappingConfiguration.ScheduleAgentClient; _sendNoAppointmentNotifications = mappingConfiguration.SendNoAppointmentNotifications; _organizerAsDelegate = mappingConfiguration.OrganizerAsDelegate; _cleanupDuplicateEvents = mappingConfiguration.CleanupDuplicateEvents; _mapEventColorToCategory = mappingConfiguration.MapEventColorToCategory; _mapCustomProperties = mappingConfiguration.MapCustomProperties; _isCategoryFilterSticky = mappingConfiguration.IsCategoryFilterSticky; _eventColorToCategoryMappings = mappingConfiguration.EventColorToCategoryMappings; if (mappingConfiguration.UserDefinedCustomPropertyMappings != null) { Array.ForEach(mappingConfiguration.UserDefinedCustomPropertyMappings, m => Mappings.Add(new PropertyMappingModel(m))); } if (!string.IsNullOrEmpty(_eventCategory)) { if (_sessionData.CategoriesById.TryGetValue(_eventCategory, out var category)) { _oneTimeSetCategoryShortcutKey = category.ShortcutKey; _oneTimeSetEventCategoryColor = category.Color; } } }
public OutlookCategory(string name, OlCategoryColor color, OlCategoryShortcutKey shortcutKey) { Name = name; Color = color; ShortcutKey = shortcutKey; }
public void AddOrUpdateCategoryNoThrow(string name, OlCategoryColor color, bool useColor, OlCategoryShortcutKey shortcutKey, bool useShortcutKey) { throw new System.NotImplementedException(); }
public void AddOrUpdateCategoryNoThrow(string name, OlCategoryColor color, bool useColor, OlCategoryShortcutKey shortcutKey, bool useShortcutKey) { try { using (var categoriesWrapper = GenericComObjectWrapper.Create(_nameSpace.Categories)) { // Here a dictionary has to be used with an case-insensitive comparer, because the indexer cannot be used to fetch // the category, since it is case sensitive (but outlook requires case insensitive uniqueness) var caseSensitiveNameByCaseInsensitiveName = new Dictionary <string, string>(); foreach (var existingCategory in categoriesWrapper.Inner.ToSafeEnumerable <Category>()) { // unassign shortcutKey from existing categories to make shortcut unique if (useShortcutKey && existingCategory.ShortcutKey == shortcutKey) { existingCategory.ShortcutKey = OlCategoryShortcutKey.olCategoryShortcutKeyNone; } caseSensitiveNameByCaseInsensitiveName.Add(existingCategory.Name, existingCategory.Name); } if (caseSensitiveNameByCaseInsensitiveName.TryGetValue(name, out var caseSensitiveName)) { using (var categoryWrapper = GenericComObjectWrapper.Create(categoriesWrapper.Inner[caseSensitiveName])) { if (useColor) { categoryWrapper.Inner.Color = color; } if (useShortcutKey) { categoryWrapper.Inner.ShortcutKey = shortcutKey; } } } else { categoriesWrapper.Inner.Add( name, useColor ? color : OlCategoryColor.olCategoryColorNone, useShortcutKey ? shortcutKey : OlCategoryShortcutKey.olCategoryShortcutKeyNone); } } } catch (System.Exception e) { s_logger.Error($"Can't update category '{name}' with color '{color}' and shortcut '{shortcutKey}'", e); } }