Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the recurrence occurence.
        /// </summary>
        /// <param name="orPattern">The or pattern.</param>
        /// <param name="recurrenceId">The recurrence id.</param>
        /// <returns></returns>
        public OutlookAppointment GetRecurrenceOccurence(Outlook.RecurrencePattern orPattern, DateTime recurrenceId)
        {
            OutlookAppointment retVal = null;

            if (this.InvokeRequired)
            {
                Func <Outlook.RecurrencePattern, DateTime, OutlookAppointment> func = GetRecurrenceOccurence;
                retVal = this.Invoke(func, orPattern, recurrenceId) as OutlookAppointment;
            }
            else
            {
                Outlook._AppointmentItem oOcurrence = orPattern.GetOccurrence(recurrenceId);
                if (oOcurrence != null)
                {
                    retVal = _factory.Create <OutlookItem>(oOcurrence) as OutlookAppointment;
                }
            }
            return(retVal);
        }
 public AppointmentSerializer(OutlookAppointment appItem)
 {
     _appItem = appItem;
 }