public void EditResponseInvite()
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug((long)this.GetHashCode(), "EditMeetingInviteEventHandler.EditResponseInvite");
            ResponseType responseType = (ResponseType)base.GetParameter("Rsp");

            this.properties = new PropertyDefinition[]
            {
                MeetingMessageSchema.CalendarProcessed,
                StoreObjectSchema.ParentItemId
            };
            CalendarItemBase calendarItemBase = null;
            MeetingRequest   meetingRequest   = null;

            try
            {
                meetingRequest   = this.GetMeetingRequest(this.properties);
                calendarItemBase = MeetingUtilities.UpdateCalendarItem(meetingRequest);
                if (calendarItemBase == null)
                {
                    throw new OwaInvalidRequestException(string.Format("calendarItemBase associated with meeting request with Id {0} is null.", base.GetParameter("Id")));
                }
                this.EditResponseInternal(responseType, calendarItemBase);
                this.UpdateItem(meetingRequest);
                Utilities.SaveItem(meetingRequest);
                meetingRequest.Load();
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(meetingRequest.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
            }
            finally
            {
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
                if (meetingRequest != null)
                {
                    meetingRequest.Dispose();
                    meetingRequest = null;
                }
            }
        }
        public void SaveMeetingInvite()
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug((long)this.GetHashCode(), "EditMeetingInviteEventHandler.SaveMeetingInvite");
            MeetingRequest meetingRequest = null;

            try
            {
                meetingRequest = this.GetMeetingRequest(new PropertyDefinition[0]);
                this.UpdateItem(meetingRequest);
                Utilities.SaveItem(meetingRequest);
                meetingRequest.Load();
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(meetingRequest.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
            }
            finally
            {
                if (meetingRequest != null)
                {
                    meetingRequest.Dispose();
                    meetingRequest = null;
                }
            }
        }
示例#3
0
        // Token: 0x06000CEA RID: 3306 RVA: 0x00045C70 File Offset: 0x00043E70
        private bool LegacyRespond(StoreObjectId itemId, string requestId, string userResponse, bool usingLongId)
        {
            MeetingRequest   meetingRequest   = null;
            CalendarItemBase calendarItemBase = null;
            StoreObjectId    storeObjectId    = null;
            StoreObjectId    storeObjectId2   = null;
            Item             item             = null;

            try
            {
                base.ProtocolLogger.IncrementValue(ProtocolLoggerData.MRItems);
                try
                {
                    item = Item.Bind(base.MailboxSession, itemId, null);
                }
                catch (ObjectNotFoundException)
                {
                    this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, userResponse, "Cannot find the meeting-request as specified in the reqest.", usingLongId);
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemNotFound");
                    return(false);
                }
                meetingRequest = (item as MeetingRequest);
                if (base.Version >= 141 && meetingRequest == null)
                {
                    calendarItemBase = (item as CalendarItemBase);
                    if (calendarItemBase != null)
                    {
                        calendarItemBase.OpenAsReadWrite();
                    }
                }
                if (meetingRequest == null && calendarItemBase == null)
                {
                    this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, userResponse, "The item is not meeting-request or calendar item.", usingLongId);
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemNotValid");
                    return(false);
                }
                item = null;
                if (meetingRequest != null)
                {
                    if (meetingRequest.IsOrganizer())
                    {
                        this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, userResponse, "The organizer of this meeting request is the mailbox owner. Checking meetingRequest.", usingLongId);
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "MRIsOrganizer");
                        return(false);
                    }
                    if (meetingRequest.IsDelegated())
                    {
                        this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, userResponse, "Cannot respond to a delegated meeting request.  Use Outlook", usingLongId);
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "MRIsDelegated");
                        return(false);
                    }
                    if (meetingRequest.IsOutOfDate())
                    {
                        this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, userResponse, "Cannot respond to a OutOfDated meeting request.", usingLongId);
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "MRIsOutOfDate");
                        return(false);
                    }
                    meetingRequest.OpenAsReadWrite();
                    storeObjectId    = meetingRequest.Id.ObjectId;
                    calendarItemBase = meetingRequest.UpdateCalendarItem(false);
                }
                if (calendarItemBase == null)
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NullCalItemInMRCmd");
                    throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, null, false);
                }
                if (calendarItemBase.IsOrganizer())
                {
                    this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, userResponse, "The organizer of this meeting request is the mailbox owner. Checking calendarItem.", usingLongId);
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "CalIsOrganizer");
                    return(false);
                }
                if (calendarItemBase.IsCancelled)
                {
                    this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, userResponse, "Cannot respond to a canceled meeting.", usingLongId);
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "CalIsCancelled");
                    return(false);
                }
                if (userResponse != null)
                {
                    ResponseType responseType;
                    if (!(userResponse == "1"))
                    {
                        if (!(userResponse == "2"))
                        {
                            if (!(userResponse == "3"))
                            {
                                goto IL_22F;
                            }
                            responseType = ResponseType.Decline;
                        }
                        else
                        {
                            responseType = ResponseType.Tentative;
                        }
                    }
                    else
                    {
                        responseType = ResponseType.Accept;
                    }
                    try
                    {
                        using (calendarItemBase.RespondToMeetingRequest(responseType))
                        {
                        }
                    }
                    catch (SaveConflictException ex)
                    {
                        this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, userResponse, "A conflict calendar item has been detected: " + ex.Message, usingLongId);
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "SavedWithConflicts");
                        return(false);
                    }
                    calendarItemBase.Load();
                    if (meetingRequest != null)
                    {
                        meetingRequest.Save(SaveMode.ResolveConflicts);
                    }
                    if (responseType != ResponseType.Decline)
                    {
                        if (calendarItemBase is CalendarItemOccurrence)
                        {
                            storeObjectId2 = ((CalendarItemOccurrence)calendarItemBase).MasterId.ObjectId;
                        }
                        else
                        {
                            storeObjectId2 = calendarItemBase.Id.ObjectId;
                        }
                    }
                    else
                    {
                        base.MailboxSession.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                        {
                            calendarItemBase.Id
                        });
                    }
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                    if (storeObjectId != null)
                    {
                        base.MailboxSession.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                        {
                            storeObjectId
                        });
                    }
                    goto IL_339;
                }
IL_22F:
                throw new ArgumentException(string.Format("Unexpected userResponse value \"{0}\"", userResponse));
            }
            finally
            {
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                }
                if (meetingRequest != null)
                {
                    meetingRequest.Dispose();
                }
                if (item != null)
                {
                    item.Dispose();
                }
            }
IL_339:
            string calendarId = null;

            if (storeObjectId2 != null)
            {
                MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(storeObjectId2);
                if (this.CalendarItemIdMapping.Contains(mailboxSyncItemId))
                {
                    calendarId = this.CalendarItemIdMapping[mailboxSyncItemId];
                }
                else
                {
                    calendarId = this.CalendarItemIdMapping.Add(mailboxSyncItemId);
                    this.calendarSyncStateChangedFlag = true;
                }
            }
            this.AppendXmlNode(requestId, StatusCode.Success, calendarId, userResponse, usingLongId);
            return(true);
        }
        // Token: 0x06002DB9 RID: 11705 RVA: 0x00102FA4 File Offset: 0x001011A4
        private void NonEditResponseInternal(bool sendResponse)
        {
            ResponseType     responseType     = (ResponseType)base.GetParameter("Rsp");
            StoreObjectType  storeObjectType  = (StoreObjectType)base.GetParameter("ItemType");
            MeetingRequest   meetingRequest   = null;
            CalendarItemBase calendarItemBase = null;

            try
            {
                StoreObjectType storeObjectType2 = storeObjectType;
                if (storeObjectType2 != StoreObjectType.MeetingRequest)
                {
                    if (storeObjectType2 == StoreObjectType.CalendarItem)
                    {
                        calendarItemBase = base.GetRequestItem <CalendarItemBase>(new PropertyDefinition[0]);
                        MeetingUtilities.ThrowIfMeetingResponseInvalid(calendarItemBase);
                    }
                }
                else
                {
                    this.properties = new PropertyDefinition[]
                    {
                        MeetingMessageSchema.CalendarProcessed,
                        StoreObjectSchema.ParentItemId
                    };
                    meetingRequest   = this.GetMeetingRequest(this.properties);
                    calendarItemBase = MeetingUtilities.UpdateCalendarItem(meetingRequest);
                    if (calendarItemBase == null)
                    {
                        throw new OwaInvalidRequestException(string.Format("calendarItem associated with meetingRequest with Id {0} is null.", base.GetParameter("Id")));
                    }
                }
                this.UpdateItem(calendarItemBase);
                Utilities.SaveItem(calendarItemBase);
                calendarItemBase.Load();
                MeetingUtilities.NonEditResponse(responseType, calendarItemBase, sendResponse, null);
                calendarItemBase.Load();
                if (meetingRequest != null)
                {
                    this.UpdateItem(meetingRequest);
                    Utilities.SaveItem(meetingRequest);
                    MeetingUtilities.DeleteMeetingRequestAfterResponse(meetingRequest);
                }
                if (storeObjectType == StoreObjectType.CalendarItem)
                {
                    this.Writer.Write("<div id=nid>");
                    this.Writer.Write(OwaStoreObjectId.CreateFromStoreObject(calendarItemBase).ToBase64String());
                    this.Writer.Write("</div>");
                }
            }
            finally
            {
                if (meetingRequest != null)
                {
                    meetingRequest.Dispose();
                    meetingRequest = null;
                }
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
            }
        }
        // Token: 0x060007B6 RID: 1974 RVA: 0x0003766C File Offset: 0x0003586C
        internal static void ApplyRollingHighlight(MeetingRequest meetingRequest, string internetMessageId, CalendarItemBase originalCalItem, OldMessageDeletion.LatestItemInfo latestInfo)
        {
            int            i = 3;
            MeetingRequest meetingRequest2 = meetingRequest;

            CalendarAssistant.TracerPfd.TracePfd <int, object, string>(0L, "PFD IWC {0} {1} Applying the rolling highlight to the item{2}", 18583, TraceContext.Get(), internetMessageId);
            if (meetingRequest2 != null)
            {
                int hashCode = meetingRequest.GetHashCode();
                PropertyDefinition changeHighlight = CalendarItemBaseSchema.ChangeHighlight;
                while (i > 0)
                {
                    try
                    {
                        if (meetingRequest2 == null)
                        {
                            meetingRequest2 = MeetingRequest.Bind(meetingRequest.Session, meetingRequest.Id);
                            meetingRequest2.OpenAsReadWrite();
                        }
                        if (latestInfo.RollingHighlight != 0)
                        {
                            int num = (int)Utils.SafeGetProperty(meetingRequest2, changeHighlight, 0);
                            if ((num & 8) == 0 && (latestInfo.RollingHighlight & 8) != 0)
                            {
                                if (!string.IsNullOrEmpty(latestInfo.LatestOldLocationStr))
                                {
                                    meetingRequest2[CalendarItemBaseSchema.OldLocation] = latestInfo.LatestOldLocationStr;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -9;
                                }
                            }
                            if ((num & 3) == 0 && (latestInfo.RollingHighlight & 3) != 0)
                            {
                                if (latestInfo.LatestOldStartTime != ExDateTime.MinValue && latestInfo.LatestOldEndTime != ExDateTime.MinValue)
                                {
                                    meetingRequest2[MeetingRequestSchema.OldStartWhole] = latestInfo.LatestOldStartTime;
                                    meetingRequest2[MeetingRequestSchema.OldEndWhole]   = latestInfo.LatestOldEndTime;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -4;
                                }
                            }
                            num |= latestInfo.RollingHighlight;
                            meetingRequest2[changeHighlight] = num;
                            if (meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                            {
                                ChangeHighlightHelper changeHighlightHelper = new ChangeHighlightHelper(num);
                                MeetingMessageType    suggestedMeetingType  = changeHighlightHelper.SuggestedMeetingType;
                                meetingRequest2.MeetingRequestType = suggestedMeetingType;
                            }
                        }
                        if (originalCalItem != null && meetingRequest2.MeetingRequestType != MeetingMessageType.NewMeetingRequest && meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                        {
                            ResponseType responseType = originalCalItem.ResponseType;
                            if (responseType == ResponseType.NotResponded || responseType == ResponseType.None)
                            {
                                meetingRequest2.MeetingRequestType    = MeetingMessageType.FullUpdate;
                                meetingRequest2[ItemSchema.IconIndex] = CalendarItemBase.CalculateMeetingRequestIcon(meetingRequest2);
                            }
                        }
                        if (!meetingRequest2.IsDirty)
                        {
                            break;
                        }
                        ConflictResolutionResult saveResults = meetingRequest2.Save(SaveMode.ResolveConflicts);
                        meetingRequest2.Load();
                        if (CalendarProcessing.CheckSaveResults(meetingRequest2, saveResults, internetMessageId))
                        {
                            break;
                        }
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                        meetingRequest2 = null;
                    }
                    catch (ObjectExistedException ex)
                    {
                        MailboxSession session = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex
                        });
                        CalendarAssistantLog.LogEntry(session, ex, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (SaveConflictException ex2)
                    {
                        MailboxSession session2 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex2
                        });
                        CalendarAssistantLog.LogEntry(session2, ex2, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (ObjectNotFoundException ex3)
                    {
                        MailboxSession session3 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1},  attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex3
                        });
                        CalendarAssistantLog.LogEntry(session3, ex3, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        break;
                    }
                    finally
                    {
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                    }
                }
            }
        }