// Token: 0x06001728 RID: 5928 RVA: 0x0008A6C0 File Offset: 0x000888C0
        public static IItem GetItem(Item xsoItem)
        {
            string  key    = EntitySyncItem.GetKey(xsoItem.Session.MailboxGuid, xsoItem.Id.ObjectId);
            IEvents events = EntitySyncItem.GetEvents(xsoItem.Session, xsoItem.Id.ObjectId);

            return(events.Read(key, null));
        }
Exemplo n.º 2
0
        private Command.ExecutionState ForwardUsingEntities(StoreObjectId smartId)
        {
            if (base.Occurrence != ExDateTime.MinValue)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NoOccurrenceSupport");
                throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.ServerError, null, false);
            }
            if (this.CalendaringContainer == null)
            {
                this.CalendaringContainer = new CalendaringContainer(base.MailboxSession, null);
            }
            if (this.StoreSession == null)
            {
                this.StoreSession = base.MailboxSession;
            }
            string  key    = EntitySyncItem.GetKey(this.StoreSession.MailboxGuid, smartId);
            IEvents events = EntitySyncItem.GetEvents(this.CalendaringContainer, this.StoreSession, smartId);

            events.Forward(key, this.forwardEventParameters, null);
            return(Command.ExecutionState.Complete);
        }
Exemplo 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);
        }
Exemplo n.º 4
0
        // Token: 0x06000767 RID: 1895 RVA: 0x00029340 File Offset: 0x00027540
        protected override int InternalExecute(int count)
        {
            string[] array = HttpUtility.UrlDecode(base.FileReference).Split(new char[]
            {
                ':'
            });
            if (array.Length != 2)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_TooManyFolders, false)
                      {
                          ErrorStringForProtocolLogger = "InvalidEntityAttachemtnId"
                      };
            }
            StoreObjectId itemId = StoreId.EwsIdToStoreObjectId(array[0]);
            IEvents       events = EntitySyncItem.GetEvents(this.CalendaringContainer, base.Session, itemId);

            if (events == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false)
                      {
                          ErrorStringForProtocolLogger = "EventsNotFound"
                      };
            }
            IAttachments attachments = events[array[0]].Attachments;

            if (attachments == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false)
                      {
                          ErrorStringForProtocolLogger = "EntityNotFound"
                      };
            }
            IAttachment attachment = attachments.Read(array[1], null);

            if (attachment == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false)
                      {
                          ErrorStringForProtocolLogger = "EntityAttachementNotFound"
                      };
            }
            base.ContentType = attachment.ContentType;
            FileAttachment fileAttachment = attachment as FileAttachment;
            ItemAttachment itemAttachment = attachment as ItemAttachment;

            if (fileAttachment != null)
            {
                if (!base.MaxAttachmentSize.IsUnlimited && fileAttachment.Content.Length > (int)base.MaxAttachmentSize.Value.ToBytes())
                {
                    throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge);
                }
                count = ((count == -1) ? fileAttachment.Content.Length : Math.Min(count, fileAttachment.Content.Length - base.MinRange));
                base.OutStream.Write(fileAttachment.Content, base.MinRange, count);
                return(count);
            }
            else
            {
                if (itemAttachment != null)
                {
                    int result;
                    AttachmentHelper.GetAttachment(base.Session, itemId, attachment.Id, base.OutStream, base.MinRange, count, base.MaxAttachmentSize, base.RightsManagementSupport, out result);
                    return(result);
                }
                throw new AirSyncPermanentException(StatusCode.Sync_InvalidWaitTime, new LocalizedString(string.Format("Attachment type \"{0}\" is not supported.", attachment.GetType().FullName)), false)
                      {
                          ErrorStringForProtocolLogger = "UnsupportedEntityAttachementType"
                      };
            }
        }
 // Token: 0x0600172A RID: 5930 RVA: 0x0008A711 File Offset: 0x00088911
 public static IEvents GetEvents(IStoreSession storeSession, StoreObjectId itemId)
 {
     return(EntitySyncItem.GetEvents(new CalendaringContainer(storeSession, null), storeSession, itemId));
 }