コード例 #1
0
        // Token: 0x06000524 RID: 1316 RVA: 0x00026DD0 File Offset: 0x00024FD0
        private int CopyIdsToTmpArray(ItemData[] sourceArray, int srcIndex, int sizeToCopy, int MaxMessageSize, out List <ItemId> destinationListEws, out List <VersionedId> destinationListStore, out bool maxMessageSizeExceeded, out int countSkipped, out Dictionary <ItemData.EnforcerType, int> itemCountPerEnforcer)
        {
            maxMessageSizeExceeded = false;
            destinationListEws     = new List <ItemId>();
            destinationListStore   = new List <VersionedId>();
            itemCountPerEnforcer   = new Dictionary <ItemData.EnforcerType, int>();
            int num = 0;

            countSkipped = 0;
            for (int i = srcIndex; i < srcIndex + sizeToCopy; i++)
            {
                if (sourceArray[i].MessageSize >= MaxMessageSize)
                {
                    countSkipped++;
                    maxMessageSizeExceeded = true;
                }
                else
                {
                    if (!itemCountPerEnforcer.ContainsKey(sourceArray[i].Enforcer))
                    {
                        itemCountPerEnforcer[sourceArray[i].Enforcer] = 0;
                    }
                    Dictionary <ItemData.EnforcerType, int> dictionary;
                    ItemData.EnforcerType enforcer;
                    (dictionary = itemCountPerEnforcer)[enforcer = sourceArray[i].Enforcer] = dictionary[enforcer] + 1;
                    destinationListStore.Add(sourceArray[i].Id);
                    string text = StoreId.StoreIdToEwsId(this.primaryMailboxSession.MailboxGuid, sourceArray[i].Id);
                    ItemId item = new ItemId(text);
                    destinationListEws.Add(item);
                    num += sourceArray[i].MessageSize;
                }
            }
            return(num);
        }
コード例 #2
0
 protected static string GetEwsId(StoreId storeId, Guid mailboxGuid)
 {
     if (storeId == null)
     {
         return(null);
     }
     return(StoreId.StoreIdToEwsId(mailboxGuid, storeId));
 }
コード例 #3
0
 // Token: 0x06000D21 RID: 3361 RVA: 0x00031088 File Offset: 0x0002F288
 protected string GetEwsId(StoreId storeId)
 {
     if (storeId == null)
     {
         return(null);
     }
     return(StoreId.StoreIdToEwsId(this.mailboxGuid, storeId));
 }
コード例 #4
0
 // Token: 0x06000D18 RID: 3352 RVA: 0x00030CAC File Offset: 0x0002EEAC
 protected void GetPartialPayloadFromNotification(RowNotificationPayload payload, QueryNotification notification)
 {
     ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "RowNotificationHandler.GetPartialPayloadFromNotification Start. SubscriptionId: {0}", base.SubscriptionId);
     payload.SubscriptionId = base.SubscriptionId;
     payload.EventType      = notification.EventType;
     payload.Prior          = Convert.ToBase64String(notification.Prior);
     payload.FolderId       = StoreId.StoreIdToEwsId(this.mailboxGuid, this.folderId);
 }
コード例 #5
0
 public virtual string ToStringId(StoreId storeId, IStoreSession session)
 {
     if (session is IPublicFolderSession)
     {
         StoreObjectId parentFolderId = session.GetParentFolderId(StoreId.GetStoreObjectId(storeId));
         return(StoreId.PublicFolderStoreIdToEwsId(storeId, parentFolderId));
     }
     return(StoreId.StoreIdToEwsId(session.MailboxGuid, storeId));
 }
コード例 #6
0
ファイル: RowNotifier.cs プロジェクト: YHZX2013/exchange_diff
        internal void AddQueryResultChangedPayload(StoreObjectId folderId, string subscriptionId)
        {
            RowNotificationPayload rowNotificationPayload = new RowNotificationPayload();

            rowNotificationPayload.FolderId       = StoreId.StoreIdToEwsId(this.mailboxGuid, folderId);
            rowNotificationPayload.EventType      = QueryNotificationType.QueryResultChanged;
            rowNotificationPayload.SubscriptionId = subscriptionId;
            rowNotificationPayload.Source         = new MailboxLocation(this.mailboxGuid);
            this.queue.Enqueue(rowNotificationPayload);
            NotificationStatisticsManager.Instance.NotificationCreated(rowNotificationPayload);
        }
コード例 #7
0
ファイル: RowNotifier.cs プロジェクト: YHZX2013/exchange_diff
        internal void AddFolderRefreshPayload(StoreObjectId folderId, string subscriptionId)
        {
            RowNotificationPayload rowNotificationPayload = new RowNotificationPayload();

            rowNotificationPayload.FolderId       = StoreId.StoreIdToEwsId(this.mailboxGuid, folderId);
            rowNotificationPayload.EventType      = QueryNotificationType.Reload;
            rowNotificationPayload.SubscriptionId = subscriptionId;
            rowNotificationPayload.Source         = new MailboxLocation(this.mailboxGuid);
            NotificationStatisticsManager.Instance.NotificationDropped(this.queue, NotificationState.CreatedOrReceived);
            this.ClearRowNotificationPayload();
            this.queue.Enqueue(rowNotificationPayload);
            NotificationStatisticsManager.Instance.NotificationCreated(rowNotificationPayload);
        }
コード例 #8
0
        // Token: 0x06000541 RID: 1345 RVA: 0x000281C0 File Offset: 0x000263C0
        private bool ProcessItem(ItemData itemData)
        {
            string     id   = StoreId.StoreIdToEwsId(this.primaryMailboxSession.MailboxGuid, itemData.Id);
            ElcEwsItem item = new ElcEwsItem
            {
                Id              = id,
                Data            = null,
                Error           = null,
                StorageItemData = itemData
            };

            this.currentBatch.Add(item);
            this.currentBatchSize += Convert.ToUInt32(itemData.MessageSize);
            return((ulong)this.currentBatchSize >= (ulong)((long)this.moveToArchiveBatchSizeLimit) || this.currentBatch.Count >= this.moveToArchiveBatchCountLimit);
        }
コード例 #9
0
 // Token: 0x06001BD9 RID: 7129 RVA: 0x0006BF04 File Offset: 0x0006A104
 private void CreateSubscriptionForWellKnownFolder(IMailboxContext userContext, SubscriptionData subscription, DefaultFolderType folderType)
 {
     try
     {
         userContext.LockAndReconnectMailboxSession(3000);
         StoreObjectId defaultFolderId = userContext.MailboxSession.GetDefaultFolderId(folderType);
         subscription.Parameters.FolderId = StoreId.StoreIdToEwsId(userContext.MailboxSession.MailboxGuid, defaultFolderId);
     }
     finally
     {
         if (userContext.MailboxSessionLockedByCurrentThread())
         {
             userContext.UnlockAndDisconnectMailboxSession();
         }
     }
     base.InternalCreateASubscription(userContext, subscription, true);
 }
コード例 #10
0
        protected override string InternalExecute()
        {
            Item   item  = null;
            Item   item2 = null;
            string result;

            try
            {
                MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession;
                item  = Item.Bind(mailboxIdentityMailboxSession, this.ndrMessageId, ItemBindOption.None);
                item2 = ((ReportMessage)item).CreateSendAgain(this.draftFolderId);
                if (this.IrmDecryptIfRestricted(item2, UserContextManager.GetUserContext(base.CallContext.HttpContext)))
                {
                    ((RightsManagedMessageItem)item2).PrepareAcquiredLicensesBeforeSave();
                }
                StoreId storeId = null;
                if (item2 is MessageItem)
                {
                    item2.Save(SaveMode.NoConflictResolutionForceSave);
                    item2.Load();
                    storeId = item2.Id;
                }
                result = StoreId.StoreIdToEwsId(base.CallContext.AccessingPrincipal.MailboxInfo.MailboxGuid, storeId);
            }
            catch (Exception ex)
            {
                OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent("Exception generating CreateResendDraft", ex));
                result = string.Empty;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
            }
            return(result);
        }
コード例 #11
0
        private void ProcessHierarchyNotification(QueryNotification notification)
        {
            VersionedId   versionedId   = notification.Row[0] as VersionedId;
            StoreObjectId storeObjectId = null;

            if (versionedId != null)
            {
                storeObjectId = versionedId.ObjectId;
            }
            if (storeObjectId == null || notification.Row[2] == null || notification.Row[3] == null || notification.Row[4] == null || notification.Row[6] == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "Hierarchy notification has a null folder id or is malformed. User: {0}", base.UserContext.PrimarySmtpAddress);
                return;
            }
            int num  = (int)notification.Row[2];
            int num2 = (int)notification.Row[3];

            if (notification.Row[6] is bool && !(bool)notification.Row[6] && !this.IsAllowedSearchFolder(storeObjectId))
            {
                return;
            }
            HierarchyNotificationPayload payloadInstance = this.GetPayloadInstance(storeObjectId);

            payloadInstance.FolderId       = StoreId.StoreIdToEwsId(this.mailboxGuid, storeObjectId);
            payloadInstance.DisplayName    = (string)notification.Row[1];
            payloadInstance.ParentFolderId = ((notification.Row[5] != null) ? StoreId.StoreIdToEwsId(this.mailboxGuid, notification.Row[5] as StoreId) : null);
            payloadInstance.ItemCount      = (long)num;
            payloadInstance.UnreadCount    = (long)num2;
            payloadInstance.SubscriptionId = base.SubscriptionId;
            payloadInstance.EventType      = notification.EventType;
            if (!(notification.Row[4] is PropertyError))
            {
                string          itemClass  = (string)notification.Row[4];
                StoreObjectType objectType = ObjectClass.GetObjectType(itemClass);
                payloadInstance.FolderType = objectType;
            }
            else
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "Hierarchy notification received PropertyError for Item Class. User: {0}", base.UserContext.PrimarySmtpAddress);
            }
            this.hierarchyNotifier.AddFolderCountPayload(storeObjectId, payloadInstance);
        }
コード例 #12
0
        // 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);
        }
コード例 #13
0
 // Token: 0x06001729 RID: 5929 RVA: 0x0008A708 File Offset: 0x00088908
 public static string GetKey(Guid mailboxGuid, StoreId itemId)
 {
     return(StoreId.StoreIdToEwsId(mailboxGuid, itemId));
 }