예제 #1
0
 public MeetingCancelWriter(MeetingCancellation meetingCancellation, UserContext userContext, bool isEmbeddedItem) : base(meetingCancellation, userContext)
 {
     this.meetingCancellation = meetingCancellation;
     if (!isEmbeddedItem && !meetingCancellation.IsDelegated())
     {
         this.isOrganizer = base.ProcessMeetingMessage(meetingCancellation, Utilities.IsItemInDefaultFolder(meetingCancellation, DefaultFolderType.Inbox));
     }
     this.messageRecipientWell = new MessageRecipientWell(userContext, meetingCancellation);
 }
예제 #2
0
        private Item BindToItemWithItemClass(StoreObjectId id, string itemClass, PropertyDefinition[] properties)
        {
            Item result;

            if (ObjectClass.IsReport(itemClass))
            {
                result = ReportMessage.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMessage(itemClass, false))
            {
                result = MessageItem.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsPost(itemClass))
            {
                result = PostItem.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsCalendarItem(itemClass))
            {
                result = CalendarItem.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMeetingRequest(itemClass))
            {
                result = MeetingRequest.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMeetingResponse(itemClass))
            {
                result = MeetingResponse.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMeetingCancellation(itemClass))
            {
                result = MeetingCancellation.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsContact(itemClass))
            {
                result = Contact.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsTask(itemClass))
            {
                Task task = Task.Bind(this.mailboxSession, id, true, properties);
                task.SuppressRecurrenceAdjustment = true;
                result = task;
            }
            else if (ObjectClass.IsDistributionList(itemClass))
            {
                result = DistributionList.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsGenericMessage(itemClass))
            {
                result = MessageItem.Bind(this.mailboxSession, id, properties);
            }
            else
            {
                result = Item.Bind(this.mailboxSession, id, properties);
            }
            return(result);
        }
예제 #3
0
        internal static bool MeetingCancellationIsOutOfDate(MeetingCancellation meetingCancellation)
        {
            if (meetingCancellation == null)
            {
                throw new ArgumentNullException("meetingCancellation");
            }
            MeetingMessageType property = ItemUtility.GetProperty <MeetingMessageType>(meetingCancellation, CalendarItemBaseSchema.MeetingRequestType, MeetingMessageType.None);

            return(property == MeetingMessageType.Outdated);
        }
예제 #4
0
 public MeetingCancelWriter(MeetingCancellation meetingCancellation, UserContext userContext, string toolbarId, bool isPreviewForm, bool isInDeletedItems, bool isEmbeddedItem, bool isInJunkEmailFolder, bool isSuspectedPhishingItem, bool isLinkEnabled) : base(meetingCancellation, userContext, isPreviewForm, isInDeletedItems, isEmbeddedItem, isInJunkEmailFolder, isSuspectedPhishingItem, isLinkEnabled)
 {
     this.meetingCancellation = meetingCancellation;
     this.isDelegated         = meetingCancellation.IsDelegated();
     if (toolbarId == null)
     {
         toolbarId = "mpToolbar";
     }
     this.isOrganizer = true;
     if (!Utilities.IsPublic(meetingCancellation) && !this.IsDraft && !isEmbeddedItem)
     {
         this.isOrganizer = base.ProcessMeetingMessage(meetingCancellation, Utilities.IsItemInDefaultFolder(meetingCancellation, DefaultFolderType.Inbox));
         this.isOutOfDate = MeetingUtilities.MeetingCancellationIsOutOfDate(meetingCancellation);
     }
     this.recipientWell = new MessageRecipientWell(meetingCancellation);
 }
예제 #5
0
 protected Item BindItem(Item item, ExchangeService service, PropertySet propertySet)
 {
     if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Appointment))
     {
         return(Appointment.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Task))
     {
         return(Task.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Contact))
     {
         return(Contact.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.ContactGroup))
     {
         return(ContactGroup.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.PostItem))
     {
         return(PostItem.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingCancellation))
     {
         return(MeetingCancellation.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingRequest))
     {
         return(MeetingRequest.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingResponse))
     {
         return(MeetingResponse.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingMessage))
     {
         return(MeetingMessage.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.EmailMessage))
     {
         return(EmailMessage.Bind(service, item.Id, propertySet));
     }
     else
     {
         throw new Exception("Unknown Exchange Item type: " + item.GetType().FullName);
     }
 }
예제 #6
0
 public static void CancelCalendarItem(UserContext userContext, CalendarItemBase calendarItemBase)
 {
     if (calendarItemBase.IsMeeting && calendarItemBase.MeetingRequestWasSent && calendarItemBase.AttendeeCollection.Count != 0)
     {
         ExTraceGlobals.CalendarTracer.TraceDebug(0L, "Sending calendarItem cancellation");
         Utilities.ValidateCalendarItemBaseStoreObject(calendarItemBase);
         using (MeetingCancellation meetingCancellation = calendarItemBase.CancelMeeting(null, null))
         {
             meetingCancellation.Send();
         }
     }
     ExTraceGlobals.CalendarTracer.TraceDebug(0L, "Deleting calendarItem due to cancellation");
     Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[]
     {
         calendarItemBase.Id
     });
 }
예제 #7
0
 // Token: 0x0600079E RID: 1950 RVA: 0x00036658 File Offset: 0x00034858
 private void ProcessMeetingCancellation(MailboxSession itemStore, MeetingCancellation mtgMessage, ref CalendarItemBase originalCalItem, string internetMessageId)
 {
     try
     {
         if (mtgMessage.TryUpdateCalendarItem(ref originalCalItem, false))
         {
             mtgMessage.Load();
             ConflictResolutionResult conflictResolutionResult = originalCalItem.Save(SaveMode.ResolveConflicts);
             originalCalItem.Load();
             if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
             {
                 throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(originalCalItem.Id), conflictResolutionResult);
             }
         }
         CalendarAssistantPerformanceCounters.MeetingCancellations.Increment();
         CalendarProcessing.TracerPfd.TracePfd <int, object, string>((long)mtgMessage.GetHashCode(), "PFD IWC {0} {1}:completed Processing Meeting Cancellation for {2}", 28823, TraceContext.Get(), internetMessageId);
     }
     catch (ObjectNotFoundException innerException)
     {
         throw new TransientException(Strings.descTransientErrorInCancellation, innerException);
     }
 }
        public void SaveMeetingCancel()
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug((long)this.GetHashCode(), "EditMeetingInviteEventHandler.SaveMeetingCancel");
            MeetingCancellation meetingCancellation = null;

            try
            {
                meetingCancellation = base.GetRequestItem <MeetingCancellation>(new PropertyDefinition[0]);
                meetingCancellation[ItemSchema.Subject] = (string)base.GetParameter("Subj");
                Utilities.SaveItem(meetingCancellation);
                meetingCancellation.Load();
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(meetingCancellation.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
            }
            finally
            {
                if (meetingCancellation != null)
                {
                    meetingCancellation.Dispose();
                    meetingCancellation = null;
                }
            }
        }
예제 #9
0
 public void CancelEvent(StoreId id, CancelEventParameters parameters, int?seriesSequenceNumber = null, bool deleteAfterCancelling = true, Event updateToEvent = null, byte[] masterGoid = null)
 {
     using (ICalendarItemBase calendarItemBase = this.Bind(id))
     {
         if (calendarItemBase.IsMeeting && !calendarItemBase.IsOrganizer())
         {
             throw new InvalidRequestException(CalendaringStrings.ErrorNotAuthorizedToCancel);
         }
         calendarItemBase.OpenAsReadWrite();
         if (updateToEvent != null)
         {
             EventTranslator.Instance.SetPropertiesFromEntityOnStorageObject(updateToEvent, calendarItemBase);
         }
         if (calendarItemBase.IsMeeting && calendarItemBase.AttendeeCollection != null && calendarItemBase.AttendeeCollection.Count > 0)
         {
             using (MeetingCancellation meetingCancellation = ((CalendarItemBase)calendarItemBase).CancelMeeting(seriesSequenceNumber, masterGoid))
             {
                 if (parameters != null)
                 {
                     EventWorkflowParametersTranslator <CancelEventParameters, CancelEventParametersSchema> .Instance.SetPropertiesFromEntityOnStorageObject(parameters, meetingCancellation);
                 }
                 MeetingMessage.SendLocalOrRemote(meetingCancellation, true, true);
                 goto IL_95;
             }
         }
         if (updateToEvent != null)
         {
             calendarItemBase.SaveWithConflictCheck(SaveMode.ResolveConflicts);
         }
         IL_95 :;
     }
     if (deleteAfterCancelling)
     {
         this.Delete(id, DeleteItemFlags.MoveToDeletedItems | DeleteItemFlags.CancelCalendarItem);
     }
 }
예제 #10
0
        // Token: 0x06000575 RID: 1397 RVA: 0x0002B488 File Offset: 0x00029688
        private void MeetingPageWriterFactory(string itemType, EventArgs e)
        {
            if (ObjectClass.IsMeetingRequest(itemType))
            {
                MeetingRequest meetingRequest = base.Item = base.Initialize <MeetingRequest>(MeetingInviteWriter.PrefetchProperties);
                this.delegateMessage   = 1491510515;
                this.meetingPageWriter = new MeetingInviteWriter(meetingRequest, base.UserContext, base.IsEmbeddedItem);
                if (meetingRequest.MeetingRequestType == MeetingMessageType.Outdated)
                {
                    base.Infobar.AddMessageLocalized(1771878760, InfobarMessageType.Informational);
                }
                else if (this.meetingPageWriter.CalendarItemBase != null)
                {
                    CalendarUtilities.AddCalendarInfobarMessages(base.Infobar, this.meetingPageWriter.CalendarItemBase, meetingRequest, base.UserContext);
                }
            }
            else if (ObjectClass.IsMeetingCancellation(itemType))
            {
                MeetingCancellation meetingCancellation = base.Item = base.Initialize <MeetingCancellation>(MeetingCancelWriter.PrefetchProperties);
                this.delegateMessage   = 1953915685;
                this.meetingPageWriter = new MeetingCancelWriter(meetingCancellation, base.UserContext, base.IsEmbeddedItem);
                if (MeetingUtilities.MeetingCancellationIsOutOfDate(meetingCancellation))
                {
                    base.Infobar.AddMessageLocalized(21101307, InfobarMessageType.Informational);
                }
                else
                {
                    base.Infobar.AddMessageLocalized(-161808760, InfobarMessageType.Informational);
                }
            }
            else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(itemType))
            {
                this.isCalendarItem = true;
                CalendarItemBase calendarItemBase = base.Item = base.Initialize <CalendarItemBase>(MeetingPageWriter.CalendarPrefetchProperties);
                this.meetingPageWriter = new CalendarItemWriter(calendarItemBase, base.UserContext);
                if (calendarItemBase != null)
                {
                    CalendarUtilities.AddCalendarInfobarMessages(base.Infobar, this.meetingPageWriter.CalendarItemBase, null, base.UserContext);
                }
            }
            else
            {
                if (!ObjectClass.IsMeetingResponse(itemType))
                {
                    ExTraceGlobals.CalendarCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unsupported item type '{0}' for meeting page", itemType);
                    throw new OwaInvalidRequestException(string.Format("Unsupported item type '{0}' for edit meeting page", itemType));
                }
                this.isMeetingResponse = true;
                MeetingResponse meetingResponse = base.Item = base.Initialize <MeetingResponse>(MeetingResponseWriter.PrefetchProperties);
                this.delegateMessage   = -1986433227;
                this.meetingPageWriter = new MeetingResponseWriter(meetingResponse, base.UserContext, base.IsEmbeddedItem);
                if (meetingResponse.From != null)
                {
                    string messageText = string.Empty;
                    switch (meetingResponse.ResponseType)
                    {
                    case ResponseType.Tentative:
                        messageText = string.Format(LocalizedStrings.GetNonEncoded(-67265594), meetingResponse.From.DisplayName);
                        break;

                    case ResponseType.Accept:
                        messageText = string.Format(LocalizedStrings.GetNonEncoded(1335319405), meetingResponse.From.DisplayName);
                        break;

                    case ResponseType.Decline:
                        messageText = string.Format(LocalizedStrings.GetNonEncoded(-1091863618), meetingResponse.From.DisplayName);
                        break;
                    }
                    base.Infobar.AddMessageText(messageText, InfobarMessageType.Informational);
                }
            }
            if (!this.isCalendarItem)
            {
                this.isDelegated = ((MeetingMessage)base.Item).IsDelegated();
            }
            this.CurrentFolderStoreObjectId = (base.IsEmbeddedItem ? base.ParentItem.ParentId : base.Item.ParentId);
            this.navigationModule           = Navigation.GetNavigationModuleFromFolder(base.UserContext, this.CurrentFolderStoreObjectId);
        }
예제 #11
0
        public void Delete()
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug((long)this.GetHashCode(), "CalendarViewEventHandler.Delete");
            OwaStoreObjectId owaStoreObjectId  = (OwaStoreObjectId)base.GetParameter("Id");
            OwaStoreObjectId owaStoreObjectId2 = (OwaStoreObjectId)base.GetParameter("fId");
            Item             item             = null;
            CalendarItemBase calendarItemBase = null;
            bool             flag             = true;

            try
            {
                item = Utilities.GetItem <Item>(base.UserContext, owaStoreObjectId, new PropertyDefinition[]
                {
                    StoreObjectSchema.EffectiveRights,
                    CalendarItemBaseSchema.MeetingRequestWasSent,
                    CalendarItemBaseSchema.IsOrganizer
                });
                calendarItemBase = (item as CalendarItemBase);
                if (calendarItemBase != null)
                {
                    if (!CalendarUtilities.UserCanDeleteCalendarItem(calendarItemBase) || Utilities.IsItemInExternalSharedInFolder(base.UserContext, calendarItemBase))
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=np></div>");
                        flag = false;
                    }
                    else if (!base.IsParameterSet("FD") && calendarItemBase.IsMeeting && calendarItemBase.MeetingRequestWasSent && calendarItemBase.IsOrganizer())
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=sc></div>");
                        flag = false;
                    }
                    else if (!base.IsParameterSet("FD") && !calendarItemBase.IsOrganizer() && !calendarItemBase.IsCancelled && !MeetingUtilities.IsCalendarItemEndTimeInPast(calendarItemBase))
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=sr></div>");
                        flag = false;
                    }
                    else if (!base.IsParameterSet("FD") && (owaStoreObjectId2.IsOtherMailbox || owaStoreObjectId2.IsGSCalendar))
                    {
                        base.ResponseContentType = OwaEventContentType.Html;
                        this.Writer.Write("<div id=divOp _sOp=sn></div>");
                        flag = false;
                    }
                }
                else if (!ItemUtility.UserCanDeleteItem(item))
                {
                    base.ResponseContentType = OwaEventContentType.Html;
                    this.Writer.Write("<div id=divOp _sOp=np></div>");
                    flag = false;
                }
                if (flag)
                {
                    bool flag2 = false;
                    if (base.IsParameterSet("Ntfy"))
                    {
                        flag2 = (bool)base.GetParameter("Ntfy");
                    }
                    if (flag2)
                    {
                        PrincipalNotificationMessage principalNotificationMessage = new PrincipalNotificationMessage(owaStoreObjectId.ToBase64String(), owaStoreObjectId2, base.UserContext, this.HttpContext, PrincipalNotificationMessage.ActionType.Delete, false, calendarItemBase.IsMeeting);
                        principalNotificationMessage.SendNotificationMessage();
                    }
                    bool flag3 = false;
                    if (base.IsParameterSet("Prm"))
                    {
                        flag3 = (bool)base.GetParameter("Prm");
                    }
                    DeleteItemFlags deleteItemFlags = DeleteItemFlags.None;
                    if (!owaStoreObjectId2.IsPublic)
                    {
                        if (calendarItemBase.IsOrganizer())
                        {
                            if (calendarItemBase.IsMeeting)
                            {
                                goto IL_269;
                            }
                            deleteItemFlags = DeleteItemFlags.CancelCalendarItem;
                            MeetingCancellation meetingCancellation = null;
                            try
                            {
                                try
                                {
                                    calendarItemBase.OpenAsReadWrite();
                                    meetingCancellation = calendarItemBase.CancelMeeting(null, null);
                                }
                                catch (ObjectNotFoundException)
                                {
                                }
                                catch (AccessDeniedException)
                                {
                                }
                                goto IL_269;
                            }
                            finally
                            {
                                if (meetingCancellation != null)
                                {
                                    meetingCancellation.Dispose();
                                }
                                meetingCancellation = null;
                            }
                        }
                        deleteItemFlags = DeleteItemFlags.DeclineCalendarItemWithoutResponse;
                    }
IL_269:
                    calendarItemBase.DeleteMeeting((flag3 ? DeleteItemFlags.SoftDelete : DeleteItemFlags.MoveToDeletedItems) | deleteItemFlags);
                    this.RenderPayload(new OwaStoreObjectId[]
                    {
                        owaStoreObjectId2
                    });
                }
            }
            catch (ObjectNotFoundException)
            {
                ExTraceGlobals.CalendarDataTracer.TraceDebug((long)this.GetHashCode(), "Calendar item could not be found.");
                throw;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
            }
        }
예제 #12
0
        /// <summary>
        /// Reply to a meeting request. You can either reply to a meeting request received in your Inbox or
        /// you can reply to the appointment in your calendar if the calendar item is automatically created
        /// in your calendar folder. This sample identifies the different options for replying
        /// to a meeting request.
        /// </summary>
        /// <param name="service">An ExchangeService object with credentials and the EWS URL.</param>
        private static void RespondToMeetingInvite(ExchangeService service)
        {
            // Specify a view that returns a single item.
            ItemView view = new ItemView(1);

            bool replyToMeetingRequest = true; // Indicates whether you will act on the meeting request or the calendar item.
            bool sendResponse          = true;
            //bool tentative = true;
            //bool replyAll = true;

            string querystringMeetingRequest = "Subject:'Status update - planning meeting' Kind:meetings";
            string querystringAppointment    = "Subject:'Status update - planning meeting'";

            if (replyToMeetingRequest)
            {
                // Find the first meeting request in the Inbox with 'Status update - planning meeting' set for the subject property.
                // This results in a FindItem operation call to EWS.
                FindItemsResults <Item> results = service.FindItems(WellKnownFolderName.Inbox, querystringMeetingRequest, view);

                if (results.TotalCount > 0)
                {
                    if (results.Items[0] is MeetingRequest)
                    {
                        MeetingRequest request = results.Items[0] as MeetingRequest;

                        // Accept the meeting invitation. This results in a CreateItem operation call to EWS
                        // with the AcceptItem response object. If the Exchange server created a tentatively
                        // accepted calendar item for this request, Exchange will change the response value for the
                        // calendar item to accepted. Exchange will move the meeting request to the Deleted Items
                        // folder.
                        CalendarActionResults responseResults = request.Accept(sendResponse);

                        // The following are other options for responding to meeting requests:
                        // CalendarActionResults responseResults = request.AcceptTentatively(sendResponse);
                        // CalendarActionResults responseResults = request.Decline(sendResponse);

                        // The following options for responding to meeting requests create a local copy of the meeting response
                        // so that you can set properties on the response before sending the meeting response message
                        // to the organizer:
                        // CalendarActionResults responseResults = request.CreateAcceptMessage(tentative);
                        // CalendarActionResults responseResults = request.CreateDeclineMessage();

                        // The following options for acting on a meeting request change the item class of the response to an
                        // email message. This allows you to send an email response that does not affect the calendar workflow.
                        // You can update the ResponseMessage object properties and then use the ResponseMessage.Send
                        // method to send the email response.
                        // ResponseMessage response = request.CreateForward();
                        // ResponseMessage response = request.CreateReply(replyAll); // Creates a reply email message to all attendees.

                        // Get the appointment that was created in response to the accepted meeting request.
                        Appointment myAppointment = responseResults.Appointment;

                        // Gets the meeting request that was moved to the Deleted Items folder after the meeting request was
                        // used to make a response to the organizer. If the meeting request was responded to from
                        // the Deleted Items folder, the value of responseResults.MeetingRequest will be null.
                        if (responseResults.MeetingRequest != null)
                        {
                            MeetingRequest deletedRequest = responseResults.MeetingRequest;
                        }
                        // Gets a copy of the response sent to the organizer. If the attendee chose not to send a
                        // response, the value of responseResults.MeetingResponse will be null.
                        if (responseResults.MeetingResponse != null)
                        {
                            MeetingResponse meetingReponse = responseResults.MeetingResponse;
                        }
                        // Gets a copy of the meeting cancellation if the organizer canceled the meeting. This will
                        // be null if the organizer has not canceled the meeting.
                        if (responseResults.MeetingCancellation != null)
                        {
                            MeetingCancellation meetingCancel = responseResults.MeetingCancellation;
                        }
                    }
                }
            }
            else // Find the automatically created calendar item in your calendar.
            {
                // Find the first appointment in the calendar with 'Status update - planning meeting' set for the subject property.
                // This results in a FindItem operation call to EWS.
                FindItemsResults <Item> results = service.FindItems(WellKnownFolderName.Calendar, querystringAppointment, view);

                if (results.TotalCount > 0)
                {
                    if (results.Items[0] is Appointment)
                    {
                        Appointment appointment = results.Items[0] as Appointment;

                        // Accept the calendar item. This results in a CreateItem operation call to EWS
                        // with the AcceptItem response object. Exchange will move the meeting
                        // request to the Deleted Items folder.
                        CalendarActionResults responseResults = appointment.Accept(sendResponse);

                        // The following are other options for responding to the meeting organizer:
                        // CalendarActionResults responseResults = appointment.AcceptTentatively(sendResponse);
                        // CalendarActionResults responseResults = appointment.Decline(sendResponse);
                        // CalendarActionResults responseResults = appointment.CreateAcceptMessage(tentative);
                        // CalendarActionResults responseResults = appointment.CreateDeclineMessage();
                        // appointment.Delete(DeleteMode.MoveToDeletedItems); // No response is sent to the organizer.
                        // ResponseMessage response = appointment.CreateForward();
                        // ResponseMessage response = appointment.CreateReply(replyAll);

                        // Gets the meeting request from the Deleted Items folder if it is present.
                        if (responseResults.MeetingRequest != null)
                        {
                            MeetingRequest deletedRequest = responseResults.MeetingRequest;
                        }
                        // Gets a copy of the response sent to the organizer. If the attendee chose not to send a
                        // response, the value of responseResults.MeetingResponse will be null.
                        if (responseResults.MeetingResponse != null)
                        {
                            MeetingResponse meetingReponse = responseResults.MeetingResponse;
                        }
                        // Gets a copy of the meeting cancellation if the organizer canceled the meeting. This will
                        // be null if the organizer has not canceled the meeting.
                        if (responseResults.MeetingCancellation != null)
                        {
                            MeetingCancellation meetingCancel = responseResults.MeetingCancellation;
                        }
                    }
                }
            }
        }