// Occurs before the form region is initialized. // To prevent the form region from appearing, set e.Cancel to true. // Use e.OutlookItem to get a reference to the current Outlook item. private void BrowserFormRegionFactory_FormRegionInitializing(object sender, FormRegionInitializingEventArgs e) { e.Cancel = false; }
/// <summary> /// Method that is called when the redmine form region for appointments is about to be initialized. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The event parameters.</param> private void AppointmentRedmineRegionFactory_FormRegionInitializing(object sender, FormRegionInitializingEventArgs e) { // Occurs before the form region is initialized. // To prevent the form region from appearing, set e.Cancel to true. // Use e.OutlookItem to get a reference to the current Outlook item. var item = e.OutlookItem as AppointmentItem; var parent = item?.Parent as MAPIFolder; if (parent != null) { if (parent.EntryID.Equals(Globals.ThisAddIn.RedmineCalendar.EntryID)) { // we do not have to cancel, because the item is being created in the redmine calendar. return; } } // The item is not in the redmine calendar, thus cancel showing the form region. e.Cancel = true; }