Esempio n. 1
0
        public OutlookItem Create(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            OutlookItem retVal = null;

            Outlook._AppointmentItem appItem = obj as Outlook._AppointmentItem;
            if (obj is Outlook._AppointmentItem)
            {
                retVal = new OutlookAppointment(_listener, (Outlook._AppointmentItem)obj);
            }
            else if (obj is Outlook.RecurrencePattern)
            {
                retVal = new OutlookRecurrencePattern(_listener, (Outlook.RecurrencePattern)obj);
            }
            else if (obj is Outlook.Exception)
            {
                retVal = new OutlookException(_listener, (Outlook.Exception)obj);
            }
            else if (obj is Outlook.Recipient)
            {
                retVal = new OutlookRecipient(_listener, (Outlook.Recipient)obj);
            }
            else if (obj is Outlook.MAPIFolder)
            {
                retVal = new OutlookFolder(_listener, (Outlook.MAPIFolder)obj);
            }

            return(retVal);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the appointment recipient.
        /// </summary>
        /// <param name="oAppItem">The o app item.</param>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public OutlookRecipient AddAppointmentRecipient(Outlook._AppointmentItem oAppItem, string name)
        {
            OutlookRecipient retVal = null;

            if (this.InvokeRequired)
            {
                Func <Outlook._AppointmentItem, string, OutlookRecipient> func = AddAppointmentRecipient;
                retVal = this.Invoke(func, oAppItem, name) as OutlookRecipient;
            }
            else
            {
                Outlook.Recipient oRecipient = oAppItem.Recipients.Add(name);
                retVal = _factory.Create <OutlookItem>(oRecipient) as OutlookRecipient;
            }
            return(retVal);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the appointment recipients.
        /// </summary>
        /// <param name="oAppItem">The o app item.</param>
        /// <returns></returns>
        public List <OutlookRecipient> GetAppointmentRecipients(Outlook._AppointmentItem oAppItem)
        {
            List <OutlookRecipient> retVal = new List <OutlookRecipient>();

            if (this.InvokeRequired)
            {
                Func <Outlook._AppointmentItem, List <OutlookRecipient> > func = this.GetAppointmentRecipients;
                retVal = (List <OutlookRecipient>) this.Invoke(func, oAppItem);
            }
            else
            {
                for (int i = 1; i <= oAppItem.Recipients.Count; i++)
                {
                    OutlookRecipient recipient = _factory.Create <OutlookItem>(oAppItem.Recipients.Item(i)) as OutlookRecipient;
                    if (recipient != null)
                    {
                        retVal.Add(recipient);
                    }
                }
            }

            return(retVal);
        }
Esempio n. 4
0
 public RecipientSerializer(OutlookRecipient recipient)
 {
     _recipient = recipient;
 }