Пример #1
0
        private GetItemJsonResponse CreateSuccessResponse(EwsCalendarItemType serviceObject)
        {
            base.TraceDebug("create successful response", new object[0]);
            GetItemJsonResponse getItemJsonResponse = new GetItemJsonResponse();

            getItemJsonResponse.Body = new GetItemResponse();
            getItemJsonResponse.Body.AddResponse(new ItemInfoResponseMessage(ServiceResultCode.Success, null, serviceObject));
            return(getItemJsonResponse);
        }
Пример #2
0
 private void ClearSensitiveInformation(EwsCalendarItemType serviceObject)
 {
     serviceObject.Subject          = ClientStrings.PrivateAppointmentSubject.ToString(base.Context.Culture);
     serviceObject.Location         = string.Empty;
     serviceObject.EnhancedLocation = null;
     if (serviceObject.Body != null)
     {
         serviceObject.Body.Value = string.Empty;
     }
 }
Пример #3
0
        protected override GetItemJsonResponse InternalExecute(PublishedCalendar publishedFolder)
        {
            base.TraceDebug("GetItemAnonymous:InternalExecute", new object[0]);
            if (publishedFolder.DetailLevel == DetailLevelEnumType.AvailabilityOnly)
            {
                return(this.CreateErrorResponse(new InvalidOperationException("Item details are not allowed"), ResponseCodeType.ErrorInvalidRequest));
            }
            StoreObjectId itemId = null;
            bool          flag;

            try
            {
                this.GetStoreObjectId(out itemId, out flag);
            }
            catch (StoragePermanentException exception)
            {
                return(this.CreateErrorResponse(exception, ResponseCodeType.ErrorInvalidRequest));
            }
            GetItemJsonResponse result;

            try
            {
                base.TraceDebug("Get item from published folder", new object[0]);
                using (DisposeGuard disposeGuard = default(DisposeGuard))
                {
                    CalendarItemBase item = publishedFolder.GetItem(itemId, GetItemAnonymous.propertiesToFetch);
                    disposeGuard.Add <CalendarItemBase>(item);
                    if (flag)
                    {
                        base.TraceDebug("Request was for a Recurring Master", new object[0]);
                        if (!(item is CalendarItemOccurrence))
                        {
                            return(this.CreateErrorResponse(new Exception("Invalid RecurrenceMasterId"), ResponseCodeType.ErrorInvalidRequest));
                        }
                        itemId = ((CalendarItemOccurrence)item).MasterId.ObjectId;
                        item   = publishedFolder.GetItem(itemId, GetItemAnonymous.propertiesToFetch);
                        disposeGuard.Add <CalendarItemBase>(item);
                    }
                    EwsCalendarItemType serviceObject = this.CreateServiceObject(item);
                    if (item.Sensitivity == Sensitivity.Private)
                    {
                        base.TraceDebug("Clear sensitive information", new object[0]);
                        this.ClearSensitiveInformation(serviceObject);
                    }
                    result = this.CreateSuccessResponse(serviceObject);
                }
            }
            catch (ObjectNotFoundException exception2)
            {
                result = this.CreateErrorResponse(exception2, ResponseCodeType.ErrorInvalidRequest);
            }
            return(result);
        }
Пример #4
0
        private EwsCalendarItemType CreateServiceObject(CalendarItemBase calendarItem)
        {
            EwsCalendarItemType         ewsCalendarItemType         = (EwsCalendarItemType)ItemType.CreateFromStoreObjectType(calendarItem.StoreObjectId.ObjectType);
            IdAndSession                idAndSession                = new IdAndSession(calendarItem.StoreObjectId, calendarItem.Session);
            ToServiceObjectPropertyList toServiceObjectPropertyList = XsoDataConverter.GetToServiceObjectPropertyList(idAndSession.Id, idAndSession.Session, base.Request.Body.ItemShape, StaticParticipantResolver.DefaultInstance);

            toServiceObjectPropertyList.CharBuffer = new char[32768];
            toServiceObjectPropertyList.ConvertStoreObjectPropertiesToServiceObject(idAndSession, calendarItem, ewsCalendarItemType);
            if (ewsCalendarItemType.Body == null)
            {
                ewsCalendarItemType.Body = new BodyContentType
                {
                    BodyType = ((base.Request.Body.ItemShape.BodyType == BodyResponseType.Text) ? BodyType.Text : BodyType.HTML),
                    Value    = string.Empty
                };
            }
            return(ewsCalendarItemType);
        }
        // Token: 0x06000D28 RID: 3368 RVA: 0x0003165C File Offset: 0x0002F85C
        protected override NotificationPayloadBase GetPayloadFromNotification(StoreObjectId folderId, QueryNotification notification)
        {
            CalendarItemNotificationPayload calendarItemNotificationPayload = new CalendarItemNotificationPayload();

            calendarItemNotificationPayload.FolderId       = StoreId.StoreIdToEwsId(base.MailboxGuid, folderId);
            calendarItemNotificationPayload.SubscriptionId = base.SubscriptionId;
            calendarItemNotificationPayload.EventType      = notification.EventType;
            calendarItemNotificationPayload.Source         = new MailboxLocation(base.MailboxGuid);
            EwsCalendarItemType ewsCalendarItemType = new EwsCalendarItemType();

            ewsCalendarItemType.InstanceKey      = notification.Index;
            calendarItemNotificationPayload.Item = ewsCalendarItemType;
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                VersionedId itemProperty = RowNotificationHandler.GetItemProperty <VersionedId>(notification, 0);
                if (itemProperty == null)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Invalid StoreId for calendar item notification.");
                    calendarItemNotificationPayload.Reload = true;
                    return(calendarItemNotificationPayload);
                }
                ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(itemProperty, new MailboxId(base.MailboxGuid), null);
                ewsCalendarItemType.ItemId  = new ItemId(concatenatedId.Id, concatenatedId.ChangeKey);
                ewsCalendarItemType.Start   = base.GetDateTimeProperty(notification, 2);
                ewsCalendarItemType.End     = base.GetDateTimeProperty(notification, 3);
                ewsCalendarItemType.Subject = RowNotificationHandler.GetItemProperty <string>(notification, 4);
                ewsCalendarItemType.LegacyFreeBusyStatusString = BusyTypeConverter.ToString((BusyType)RowNotificationHandler.GetItemProperty <int>(notification, 5));
                ewsCalendarItemType.IsAllDayEvent = RowNotificationHandler.GetItemProperty <bool?>(notification, 6);
                ewsCalendarItemType.IsRecurring   = new bool?(RowNotificationHandler.GetItemProperty <byte[]>(notification, 7) != null);
                if (RowNotificationHandler.IsPropertyDefined(notification, 8))
                {
                    ewsCalendarItemType.Organizer = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[8]);
                }
                ewsCalendarItemType.IsMeeting            = RowNotificationHandler.GetItemProperty <bool?>(notification, 9);
                ewsCalendarItemType.MyResponseTypeString = ResponseTypeConverter.ToString((ResponseType)RowNotificationHandler.GetItemProperty <int>(notification, 10));
                ewsCalendarItemType.SensitivityString    = SensitivityConverter.ToString(RowNotificationHandler.GetItemProperty <Sensitivity>(notification, 11));
                ewsCalendarItemType.HasAttachments       = RowNotificationHandler.GetItemProperty <bool?>(notification, 12);
                LocationSourceType itemProperty2 = (LocationSourceType)RowNotificationHandler.GetItemProperty <int>(notification, 26);
                ewsCalendarItemType.EnhancedLocation = ((itemProperty2 == LocationSourceType.None) ? new EnhancedLocationType
                {
                    DisplayName = RowNotificationHandler.GetItemProperty <string>(notification, 13),
                    PostalAddress = new Microsoft.Exchange.Services.Core.Types.PostalAddress()
                } : new EnhancedLocationType
                {
                    DisplayName = RowNotificationHandler.GetItemProperty <string>(notification, 24),
                    Annotation = RowNotificationHandler.GetItemProperty <string>(notification, 25),
                    PostalAddress = new Microsoft.Exchange.Services.Core.Types.PostalAddress
                    {
                        LocationSource = itemProperty2,
                        LocationUri = RowNotificationHandler.GetItemProperty <string>(notification, 27),
                        Latitude = this.GetLocationPropertyValue(notification, 28),
                        Longitude = this.GetLocationPropertyValue(notification, 29),
                        Accuracy = this.GetLocationPropertyValue(notification, 30),
                        Altitude = this.GetLocationPropertyValue(notification, 31),
                        AltitudeAccuracy = this.GetLocationPropertyValue(notification, 32),
                        Street = RowNotificationHandler.GetItemProperty <string>(notification, 33),
                        City = RowNotificationHandler.GetItemProperty <string>(notification, 34),
                        State = RowNotificationHandler.GetItemProperty <string>(notification, 35),
                        Country = RowNotificationHandler.GetItemProperty <string>(notification, 36),
                        PostalCode = RowNotificationHandler.GetItemProperty <string>(notification, 37)
                    }
                });
                StoreId itemProperty3 = RowNotificationHandler.GetItemProperty <StoreId>(notification, 14);
                ewsCalendarItemType.ParentFolderId = IdConverter.GetFolderIdFromStoreId(itemProperty3, new MailboxId(base.MailboxGuid));
                byte[] itemProperty4 = RowNotificationHandler.GetItemProperty <byte[]>(notification, 15);
                if (itemProperty4 != null)
                {
                    try
                    {
                        GlobalObjectId globalObjectId = new GlobalObjectId(itemProperty4);
                        ewsCalendarItemType.UID = globalObjectId.Uid;
                    }
                    catch (CorruptDataException ex)
                    {
                        ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "Exception setting the UID in CalendarItemNotificationHandler:GetPayloadFromNotification. Exception: {1}", ex.Message);
                    }
                }
                ewsCalendarItemType.AppointmentState       = new int?(RowNotificationHandler.GetItemProperty <int>(notification, 16));
                ewsCalendarItemType.IsCancelled            = new bool?((ewsCalendarItemType.AppointmentState.Value & 4) == 4);
                ewsCalendarItemType.CalendarItemTypeString = CalendarItemTypeConverter.ToString(RowNotificationHandler.GetItemProperty <CalendarItemType>(notification, 17));
                ewsCalendarItemType.AppointmentReplyTime   = base.GetDateTimeProperty(notification, 18);
                if (RowNotificationHandler.IsPropertyDefined(notification, 19))
                {
                    ewsCalendarItemType.JoinOnlineMeetingUrl = RowNotificationHandler.GetItemProperty <string>(notification, 19);
                }
                ewsCalendarItemType.Categories  = RowNotificationHandler.GetItemProperty <string[]>(notification, 20);
                ewsCalendarItemType.IsOrganizer = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, 23));
                ConversationId itemProperty5 = RowNotificationHandler.GetItemProperty <ConversationId>(notification, 21);
                string         id            = IdConverter.ConversationIdToEwsId(base.MailboxGuid, itemProperty5);
                ewsCalendarItemType.ConversationId      = new ItemId(id, null);
                ewsCalendarItemType.IsResponseRequested = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, 22));
                try
                {
                    base.UserContext.LockAndReconnectMailboxSession(3000);
                    ewsCalendarItemType.EffectiveRights = EffectiveRightsProperty.GetFromEffectiveRights(EffectiveRights.Modify | EffectiveRights.Read | EffectiveRights.Delete, base.UserContext.MailboxSession);
                }
                finally
                {
                    if (base.UserContext.MailboxSessionLockedByCurrentThread())
                    {
                        base.UserContext.UnlockAndDisconnectMailboxSession();
                    }
                }
            }
            return(calendarItemNotificationPayload);
        }