// 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);
        }
示例#2
0
        // Token: 0x06000F60 RID: 3936 RVA: 0x0003BCB8 File Offset: 0x00039EB8
        private static ItemType GetItemFromDataRow(OwaSearchContext searchContext, MailboxSession mailboxSession, object[] row, Dictionary <PropertyDefinition, int> orderDictionary)
        {
            StoreId       itemProperty  = SearchFolderDataRetrieverBase.GetItemProperty <StoreId>(row, orderDictionary[ItemSchema.Id], null);
            StoreObjectId storeObjectId = StoreId.GetStoreObjectId(itemProperty);
            ItemType      itemType      = ItemType.CreateFromStoreObjectType(storeObjectId.ObjectType);

            itemType.ItemId = SearchFolderDataRetrieverBase.StoreIdToEwsItemId(itemProperty, new MailboxId(mailboxSession.MailboxGuid, false));
            byte[] itemProperty2 = SearchFolderDataRetrieverBase.GetItemProperty <byte[]>(row, orderDictionary[ItemSchema.InstanceKey], new byte[0]);
            itemType.InstanceKey       = itemProperty2;
            itemType.InstanceKeyString = Convert.ToBase64String(itemProperty2);
            itemType.ParentFolderId    = new FolderId(SearchFolderDataRetrieverBase.GetEwsId(SearchFolderDataRetrieverBase.GetItemProperty <StoreId>(row, orderDictionary[StoreObjectSchema.ParentItemId], null), mailboxSession.MailboxGuid), null);
            itemType.ConversationId    = new ItemId(IdConverter.ConversationIdToEwsId(mailboxSession.MailboxGuid, SearchFolderDataRetrieverBase.GetItemProperty <ConversationId>(row, orderDictionary[ItemSchema.ConversationId], null)), null);
            itemType.Subject           = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ItemSchema.Subject], string.Empty);
            itemType.ImportanceString  = SearchFolderDataRetrieverBase.GetItemProperty <Importance>(row, orderDictionary[ItemSchema.Importance], Importance.Normal).ToString();
            itemType.SensitivityString = SearchFolderDataRetrieverBase.GetItemProperty <Sensitivity>(row, orderDictionary[ItemSchema.Sensitivity], Sensitivity.Normal).ToString();
            string dateTimeProperty = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ItemSchema.ReceivedTime]);

            if (!string.IsNullOrEmpty(dateTimeProperty))
            {
                itemType.DateTimeReceived = dateTimeProperty;
            }
            string dateTimeProperty2 = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ItemSchema.SentTime]);

            if (!string.IsNullOrEmpty(dateTimeProperty2))
            {
                itemType.DateTimeSent = dateTimeProperty2;
            }
            itemType.HasAttachments = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ItemSchema.HasAttachment], false));
            itemType.IsDraft        = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[MessageItemSchema.IsDraft], false));
            itemType.ItemClass      = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[StoreObjectSchema.ItemClass], string.Empty);
            itemType.Preview        = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ItemSchema.Preview], string.Empty);
            MessageType messageType = itemType as MessageType;

            if (messageType != null)
            {
                Participant itemProperty3 = SearchFolderDataRetrieverBase.GetItemProperty <Participant>(row, orderDictionary[ItemSchema.From], null);
                if (itemProperty3 != null)
                {
                    messageType.From = RowNotificationHandler.CreateRecipientFromParticipant(itemProperty3);
                }
                Participant itemProperty4 = SearchFolderDataRetrieverBase.GetItemProperty <Participant>(row, orderDictionary[ItemSchema.Sender], null);
                if (itemProperty4 != null)
                {
                    messageType.Sender = RowNotificationHandler.CreateRecipientFromParticipant(itemProperty4);
                }
                messageType.IsRead = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[MessageItemSchema.IsRead], false));
            }
            IconIndex itemProperty5 = SearchFolderDataRetrieverBase.GetItemProperty <IconIndex>(row, orderDictionary[ItemSchema.IconIndex], IconIndex.Default);

            if (itemProperty5 != IconIndex.Default)
            {
                itemType.IconIndexString = itemProperty5.ToString();
            }
            FlagType flagType = new FlagType();

            itemType.Flag             = flagType;
            flagType.FlagStatus       = SearchFolderDataRetrieverBase.GetItemProperty <FlagStatus>(row, orderDictionary[ItemSchema.FlagStatus], FlagStatus.NotFlagged);
            itemType.DateTimeCreated  = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.CreationTime]);
            itemType.LastModifiedTime = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.LastModifiedTime]);
            itemType.Size             = SearchFolderDataRetrieverBase.GetItemProperty <int?>(row, orderDictionary[ItemSchema.Size], null);
            itemType.DisplayTo        = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ItemSchema.DisplayTo], null);
            itemType.Categories       = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ItemSchema.Categories], null);
            return(itemType);
        }
        private ItemType GetMessageItemFromNotification(QueryNotification notification)
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[MessageItemRowNotificationHandler.GetMessageItemFromNotification] Start. SubscriptionId: {0}", base.SubscriptionId);
            ItemType itemType;

            if (notification.EventType == QueryNotificationType.RowDeleted)
            {
                itemType = new MessageType
                {
                    InstanceKey = notification.Index
                };
            }
            else
            {
                StoreId       itemProperty  = RowNotificationHandler.GetItemProperty <StoreId>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Id));
                StoreObjectId storeObjectId = StoreId.GetStoreObjectId(itemProperty);
                itemType                   = ItemType.CreateFromStoreObjectType(storeObjectId.ObjectType);
                itemType.InstanceKey       = notification.Index;
                itemType.ItemId            = this.StoreIdToEwsItemId(itemProperty);
                itemType.ParentFolderId    = new FolderId(base.GetEwsId(RowNotificationHandler.GetItemProperty <StoreId>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.ParentItemId))), null);
                itemType.ConversationId    = new ItemId(IdConverter.ConversationIdToEwsId(base.MailboxGuid, RowNotificationHandler.GetItemProperty <ConversationId>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ConversationId))), null);
                itemType.Subject           = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Subject));
                itemType.ImportanceString  = RowNotificationHandler.GetItemProperty <Importance>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Importance), Importance.Normal).ToString();
                itemType.SensitivityString = RowNotificationHandler.GetItemProperty <Sensitivity>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Sensitivity), Sensitivity.Normal).ToString();
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedTime)))
                {
                    itemType.DateTimeReceived = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedTime));
                }
                itemType.HasAttachments = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.HasAttachment)));
                itemType.IsDraft        = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemSchema.IsDraft)));
                itemType.ItemClass      = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.ItemClass));
                MessageType messageType = itemType as MessageType;
                if (messageType != null)
                {
                    if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.From)))
                    {
                        messageType.From = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.From)]);
                    }
                    if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Sender)))
                    {
                        messageType.Sender = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Sender)]);
                    }
                    messageType.IsRead = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemSchema.IsRead)));
                }
                FlagType flagType = new FlagType();
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.CompleteDate)))
                {
                    flagType.CompleteDate = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.CompleteDate));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.FlagStatus)))
                {
                    flagType.FlagStatus = RowNotificationHandler.GetItemProperty <FlagStatus>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.FlagStatus), FlagStatus.NotFlagged);
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.StartDate)))
                {
                    flagType.StartDate = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.StartDate));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.DueDate)))
                {
                    flagType.DueDate = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.DueDate));
                }
                itemType.Flag = flagType;
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.CreationTime)))
                {
                    itemType.DateTimeCreated = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.CreationTime));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.LastModifiedTime)))
                {
                    itemType.LastModifiedTime = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.LastModifiedTime));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedOrRenewTime)))
                {
                    itemType.ReceivedOrRenewTime = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedOrRenewTime));
                }
                itemType.Categories = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Categories));
                itemType.Preview    = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Preview), null);
                itemType.Size       = RowNotificationHandler.GetItemProperty <int?>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Size), null);
                itemType.AddExtendedPropertyValue(new ExtendedPropertyType(WellKnownProperties.NormalizedSubject, RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.normalizedSubjectPropertyDefinition), null)));
                itemType.DisplayTo = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.DisplayTo), null);
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.IconIndex)))
                {
                    IconIndex itemProperty2 = (IconIndex)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.IconIndex));
                    if (itemProperty2 > (IconIndex)0)
                    {
                        itemType.IconIndexString = itemProperty2.ToString();
                    }
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.SentTime)))
                {
                    itemType.DateTimeSent = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.SentTime));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutedPropertyDefinition)))
                {
                    itemType.AddExtendedPropertyValue(new ExtendedPropertyType(WellKnownProperties.LastVerbExecuted, RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutedPropertyDefinition)).ToString()));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutionTimePropertyDefinition)))
                {
                    itemType.AddExtendedPropertyValue(new ExtendedPropertyType(WellKnownProperties.LastVerbExecutionTime, base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutionTimePropertyDefinition))));
                }
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[MessageItemRowNotificationHandler.GetMessageItemFromNotification] End. SubscriptionId: {0}", base.SubscriptionId);
            }
            return(itemType);
        }