/// <summary> /// Load the settings from the registry /// </summary> public void LoadSettings() { try { RegistryKey LobjKey = Registry.CurrentUser.OpenSubKey(Common.REGPATH, false); // if the key does not exist, we create it if (LobjKey == null) { // create it LobjKey = Registry.CurrentUser.CreateSubKey(Common.REGPATH); } Recipients = new ExtendedRecipientList(); string LstrList = LobjKey.GetValue("Recipients", "").ToString(); Recipients.FromRegistryString(LstrList); if (Recipients.Count == 0) { Recipients.Add(new ExtendedRecipient(Globals.ThisAddIn.Application.Session.CurrentUser)); } this.PrintWhat = LobjKey.GetValue("PrintWhat", "").ToString(); this.ShowHeader = bool.Parse(LobjKey.GetValue("ShowHeader", 1).ToString()); this.ExportWhat = LobjKey.GetValue("ExportWhat", ExportType.All).ToString().GetEnumFromName <ExportType>(); this.ShowLocation = bool.Parse(LobjKey.GetValue("ShowLocation", true).ToString()); this.EmphasizeRecurring = bool.Parse(LobjKey.GetValue("EmphasizeRecurring", false).ToString()); this.DisplayTimeOnly = bool.Parse(LobjKey.GetValue("DisplayTimeOnly", false).ToString()); this.ExcludePrivate = bool.Parse(LobjKey.GetValue("ExcludePrivate", false).ToString()); } catch (Exception PobjEx) { throw new Exception("Load settings from registry failed. " + PobjEx.Message); } }
/// <summary> /// Public emthod that gets a list of Extended Recipients /// </summary> /// <returns></returns> public ExtendedRecipientList GetRecipients() { ExtendedRecipientList LobjList = new ExtendedRecipientList(); foreach (ExtendedRecipient LobjItem in MobjRecipients.Values) { LobjList.Add(LobjItem); } return(LobjList); }
/// <summary> /// EXTENSION METHOD /// Takes a Recipients Object list and converts it to a /// List of Outlook Recipient objects /// </summary> /// <param name="PobjRecipients"></param> /// <returns></returns> public static ExtendedRecipientList ToListOfExtendedRecipient(this Outlook.Recipients PobjRecipients) { try { ExtendedRecipientList LobjResult = new ExtendedRecipientList(); foreach (Outlook.Recipient LobjItem in PobjRecipients) { LobjResult.Add(new ExtendedRecipient(LobjItem)); } return(LobjResult); } catch { return(null); } }
/// <summary> /// Created a new Extended appointment from an existing appointment /// </summary> /// <param name="PobjItem"></param> public ExtendedAppointment(Outlook.AppointmentItem PobjItem, ExtendedRecipient PobjRecipient) { try { Start = PobjItem.Start; End = PobjItem.End; Subject = PobjItem.Subject; Location = PobjItem.Location; Guid = PobjItem.GlobalAppointmentID; Recurring = PobjItem.IsRecurring; IsMeeting = (PobjItem.MeetingStatus != Outlook.OlMeetingStatus.olNonMeeting); Recipients = new ExtendedRecipientList(); Recipients.Add(PobjRecipient); } catch (Exception PobjEx) { throw new Exception("Unable to add appointment " + PobjItem.Subject + " from " + PobjRecipient.RecipientName + "'s calendar. " + PobjEx.Message); } }