Ejemplo n.º 1
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);
     }
 }
        // Token: 0x060007BC RID: 1980 RVA: 0x00037DC8 File Offset: 0x00035FC8
        public static void CleanUp(MailboxSession mailboxSession, MeetingMessage item, CalendarItemBase originalCalItem, Trace tracer, out bool fullUpdateDeleted)
        {
            fullUpdateDeleted = false;
            byte[] valueOrDefault = item.GetValueOrDefault <byte[]>(CalendarItemBaseSchema.GlobalObjectId, null);
            if (valueOrDefault == null)
            {
                return;
            }
            int valueOrDefault2 = item.GetValueOrDefault <int>(CalendarItemBaseSchema.AppointmentSequenceNumber, -1);

            if (valueOrDefault2 == -1)
            {
                return;
            }
            OldMessageDeletion.LatestItemInfo latestInfo;
            latestInfo.LatestSequenceNumber = -1;
            List <VersionedId> oldMeetingMessages = RUMOldMessageDeletion.GetOldMeetingMessages(mailboxSession, item, valueOrDefault, valueOrDefault2, out latestInfo);

            if (oldMeetingMessages == null && latestInfo.LatestSequenceNumber >= valueOrDefault2)
            {
                RUMOldMessageDeletion.MarkMeetingMessageAsOld(item, tracer);
                fullUpdateDeleted = false;
                return;
            }
            if (oldMeetingMessages != null && oldMeetingMessages.Count > 0)
            {
                foreach (VersionedId storeId in oldMeetingMessages)
                {
                    using (MeetingMessage meetingMessage = MeetingMessage.Bind(mailboxSession, storeId))
                    {
                        RUMOldMessageDeletion.MarkMeetingMessageAsOld(meetingMessage, tracer);
                    }
                }
            }
            MeetingRequest meetingRequest = item as MeetingRequest;

            if (meetingRequest != null)
            {
                OldMessageDeletion.ApplyRollingHighlight(meetingRequest, item.InternetMessageId, originalCalItem, latestInfo);
            }
            fullUpdateDeleted = latestInfo.FullUpdateDeleted;
        }
Ejemplo n.º 3
0
        // Token: 0x06000CE9 RID: 3305 RVA: 0x000459B0 File Offset: 0x00043BB0
        private bool Respond(StoreObjectId itemId, string requestId, MeetingResponseCommand.RequestNodeData response, bool usingLongId)
        {
            if (base.Version <= 141)
            {
                return(this.LegacyRespond(itemId, requestId, response.UserResponse, usingLongId));
            }
            if (response.RespondToEventParameters == null)
            {
                throw new InvalidOperationException("Response.RespondToEventParameters must not be null at this point.");
            }
            StoreObjectId storeObjectId = null;
            string        calendarId    = null;

            if (this.CalendaringContainer == null)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Set default CalendaringContainer");
                this.CalendaringContainer = new CalendaringContainer(base.MailboxSession, null);
            }
            if (this.MailboxGuid == Guid.Empty)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Set default MailboxGuid");
                this.MailboxGuid = base.MailboxSession.MailboxGuid;
            }
            string  key = EntitySyncItem.GetKey(this.MailboxGuid, itemId);
            IEvents events;

            if (itemId.ObjectType == StoreObjectType.CalendarItem || itemId.ObjectType == StoreObjectType.CalendarItemOccurrence || itemId.ObjectType == StoreObjectType.CalendarItemSeries)
            {
                storeObjectId = itemId;
                events        = EntitySyncItem.GetEvents(this.CalendaringContainer, base.MailboxSession, itemId);
            }
            else
            {
                if (itemId.ObjectType != StoreObjectType.MeetingRequest)
                {
                    this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, response.UserResponse, "The item is not meeting-request or calendar item.", usingLongId);
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UnsupportedObjectType" + itemId.ObjectType);
                    return(false);
                }
                using (MeetingMessage meetingMessage = MeetingMessage.Bind(base.MailboxSession, itemId))
                {
                    if (meetingMessage == null)
                    {
                        this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, response.UserResponse, "Cannot find the meeting-request as specified in the reqest.", usingLongId);
                        base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemNotFound");
                        return(false);
                    }
                    using (CalendarItemBase correlatedItem = meetingMessage.GetCorrelatedItem())
                    {
                        if (meetingMessage == null)
                        {
                            this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, response.UserResponse, "Cannot find the correlated meeitng item.", usingLongId);
                            base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NullCalItemInMRCmd");
                            return(false);
                        }
                        storeObjectId = correlatedItem.Id.ObjectId;
                    }
                }
                response.RespondToEventParameters.MeetingRequestIdToBeDeleted = key;
                key    = EntitySyncItem.GetKey(this.MailboxGuid, storeObjectId);
                events = this.CalendaringContainer.Calendars.Default.Events;
            }
            try
            {
                events.Respond(key, response.RespondToEventParameters, null);
            }
            catch (LocalizedException ex)
            {
                this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, response.UserResponse, ex.Message, usingLongId);
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "EntityRespondError");
                return(false);
            }
            if (storeObjectId != null)
            {
                MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(storeObjectId);
                if (this.CalendarItemIdMapping.Contains(mailboxSyncItemId))
                {
                    calendarId = this.CalendarItemIdMapping[mailboxSyncItemId];
                }
                else
                {
                    calendarId = this.CalendarItemIdMapping.Add(mailboxSyncItemId);
                    this.calendarSyncStateChangedFlag = true;
                }
            }
            this.AppendXmlNode(requestId, StatusCode.Success, calendarId, response.UserResponse, usingLongId);
            return(true);
        }