Example #1
0
        public static MailboxMiscFlags GetMailboxTableFlags(ExRpcAdmin rpcAdmin, Guid mdbGuid, Guid mailboxGuid)
        {
            MailboxMiscFlags result = MailboxMiscFlags.None;

            try
            {
                PropValue[][] mailboxTableInfo = rpcAdmin.GetMailboxTableInfo(mdbGuid, mailboxGuid, new PropTag[]
                {
                    PropTag.UserGuid,
                    PropTag.MailboxMiscFlags
                });
                if (mailboxTableInfo != null)
                {
                    foreach (PropValue[] array2 in mailboxTableInfo)
                    {
                        if (array2 != null && array2.Length == 2 && array2[0].PropTag == PropTag.UserGuid)
                        {
                            byte[] bytes = array2[0].GetBytes();
                            Guid   a     = (bytes != null && bytes.Length == 16) ? new Guid(bytes) : Guid.Empty;
                            if (a == mailboxGuid)
                            {
                                result = (MailboxMiscFlags)((array2[1].PropTag == PropTag.MailboxMiscFlags) ? array2[1].GetInt() : 0);
                            }
                        }
                    }
                }
            }
            catch (MapiExceptionNotFound)
            {
            }
            return(result);
        }
Example #2
0
 private static bool IsStoreDisconnectedMailboxInternal(ExRpcAdmin rpcAdmin, Guid mdbGuid, Guid mailboxGuid)
 {
     PropValue[][] mailboxTableInfo = rpcAdmin.GetMailboxTableInfo(mdbGuid, mailboxGuid, MailboxTableFlags.IncludeSoftDeletedMailbox, new PropTag[]
     {
         PropTag.UserGuid,
         PropTag.MailboxMiscFlags
     });
     if (mailboxTableInfo == null)
     {
         throw new RecipientNotFoundPermanentException(mailboxGuid);
     }
     foreach (PropValue[] array2 in mailboxTableInfo)
     {
         if (array2.Length == 2 && array2[0].PropTag == PropTag.UserGuid)
         {
             byte[] bytes = array2[0].GetBytes();
             Guid   a     = (bytes != null && bytes.Length == 16) ? new Guid(bytes) : Guid.Empty;
             if (!(a != mailboxGuid))
             {
                 MailboxMiscFlags mailboxMiscFlags = (MailboxMiscFlags)((array2[1].PropTag == PropTag.MailboxMiscFlags) ? array2[1].GetInt() : 0);
                 return(mailboxMiscFlags.HasFlag(MailboxMiscFlags.SoftDeletedMailbox) || mailboxMiscFlags.HasFlag(MailboxMiscFlags.DisabledMailbox) || mailboxMiscFlags.HasFlag(MailboxMiscFlags.MRSSoftDeletedMailbox));
             }
         }
     }
     throw new RecipientNotFoundPermanentException(mailboxGuid);
 }
Example #3
0
        // Token: 0x06001561 RID: 5473 RVA: 0x00079BAC File Offset: 0x00077DAC
        public MailboxProcessorMailboxData(DatabaseInfo databaseInfo, Guid mailboxGuid, int mailboxNumber, PropValue[] row) : base(mailboxGuid, mailboxNumber, databaseInfo.Guid)
        {
            MailboxProcessorAssistantType.TraceInformation(0L, "Retrieving mailbox information for database {0}", new object[]
            {
                databaseInfo.Guid
            });
            this.DatabaseName = databaseInfo.DatabaseName;
            PropValue mailboxProperty = MailboxTableQuery.GetMailboxProperty(row, PropTag.MailboxMiscFlags);

            if (mailboxProperty.PropTag == PropTag.MailboxMiscFlags)
            {
                MailboxMiscFlags @int = (MailboxMiscFlags)mailboxProperty.GetInt();
                this.IsMoveDestination = ((@int & MailboxMiscFlags.CreatedByMove) == MailboxMiscFlags.CreatedByMove);
                this.IsArchive         = ((@int & MailboxMiscFlags.ArchiveMailbox) == MailboxMiscFlags.ArchiveMailbox);
            }
            else
            {
                MailboxProcessorAssistantType.TraceInformation(0L, "Cannot retrieve property MailboxMiscFlags for Mailbox with GUID {0}", new object[]
                {
                    mailboxGuid
                });
                this.IsMoveDestination = false;
                this.IsArchive         = false;
            }
            PropValue mailboxProperty2 = MailboxTableQuery.GetMailboxProperty(row, PropTag.PersistableTenantPartitionHint);

            this.TenantPartitionHint = null;
            if (mailboxProperty2.PropTag == PropTag.PersistableTenantPartitionHint)
            {
                byte[] bytes = mailboxProperty2.GetBytes();
                if (bytes != null && bytes.Length != 0)
                {
                    this.TenantPartitionHint = TenantPartitionHint.FromPersistablePartitionHint(bytes);
                }
            }
            else
            {
                MailboxProcessorAssistantType.TraceInformation(0L, "Cannot retrieve property PersistableTenantPartitionHint for Mailbox with GUID {0}", new object[]
                {
                    mailboxGuid
                });
            }
            MailboxProcessorAssistantType.TraceInformation(0L, "Found mailbox with GUID {0}. Is archive: {1}", new object[]
            {
                mailboxGuid,
                this.IsArchive
            });
        }
        private bool?CheckMailboxMiscFlags(MailboxMiscFlags flags)
        {
            bool?  result = null;
            object obj    = this[MailboxStatisticsSchema.MailboxMiscFlags];

            if (obj != null)
            {
                if (((MailboxMiscFlags)obj & flags) == flags)
                {
                    result = new bool?(true);
                }
                else
                {
                    result = new bool?(false);
                }
            }
            return(result);
        }
Example #5
0
        private bool DoesMailboxExist()
        {
            ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher>((long)this.GetHashCode(), "{0}: Searching for mailbox", this);
            if (this.MailboxGuid == Guid.Empty)
            {
                return(false);
            }
            bool result;

            using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=EBA", null, null, null, null))
            {
                try
                {
                    PropValue[][] mailboxTableInfo = exRpcAdmin.GetMailboxTableInfo(this.DatabaseInfo.Guid, this.MailboxGuid, MailboxTableFlags.IncludeSoftDeletedMailbox, new PropTag[]
                    {
                        PropTag.MailboxMiscFlags
                    });
                    if (mailboxTableInfo.Length < 1 || mailboxTableInfo[0].Length < 1)
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher>((long)this.GetHashCode(), "{0}: GetMailboxTableInfo returned invalid response", this);
                        return(false);
                    }
                    MailboxMiscFlags @int = (MailboxMiscFlags)mailboxTableInfo[0][0].GetInt(0);
                    if ((@int & MailboxMiscFlags.CreatedByMove) != MailboxMiscFlags.None)
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher>((long)this.GetHashCode(), "{0}: Mailbox is the destination mailbox for the move.", this);
                        return(true);
                    }
                    if ((@int & (MailboxMiscFlags.DisabledMailbox | MailboxMiscFlags.SoftDeletedMailbox | MailboxMiscFlags.MRSSoftDeletedMailbox)) != MailboxMiscFlags.None)
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher, string>((long)this.GetHashCode(), "{0}: Mailbox exists in mailbox table, but marked as inaccessible: {1}", this, @int.ToString());
                        return(false);
                    }
                }
                catch (MapiExceptionNotFound arg)
                {
                    ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher, MapiExceptionNotFound>((long)this.GetHashCode(), "{0}: Mailbox does not exist: {1}", this, arg);
                    return(false);
                }
                ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher>((long)this.GetHashCode(), "{0}: Mailbox exists", this);
                result = true;
            }
            return(result);
        }
        public static bool IsMailboxLocked(string serverFQDN, Guid dbGuid, Guid mbxGuid)
        {
            bool result;

            using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=Management", serverFQDN, null, null, null))
            {
                PropValue[][] array;
                try
                {
                    array = exRpcAdmin.GetMailboxTableInfo(dbGuid, mbxGuid, new PropTag[]
                    {
                        PropTag.UserGuid,
                        PropTag.MailboxMiscFlags
                    });
                }
                catch (MapiExceptionNotFound)
                {
                    array = null;
                }
                bool flag = false;
                if (array != null)
                {
                    foreach (PropValue[] array3 in array)
                    {
                        if (array3 != null && array3.Length == 2 && array3[0].PropTag == PropTag.UserGuid)
                        {
                            byte[] bytes = array3[0].GetBytes();
                            Guid   a     = (bytes != null && bytes.Length == 16) ? new Guid(bytes) : Guid.Empty;
                            if (a == mbxGuid)
                            {
                                MailboxMiscFlags mailboxMiscFlags = (MailboxMiscFlags)((array3[1].PropTag == PropTag.MailboxMiscFlags) ? array3[1].GetInt() : 0);
                                flag = ((mailboxMiscFlags & MailboxMiscFlags.CreatedByMove) != MailboxMiscFlags.None);
                                break;
                            }
                        }
                    }
                }
                result = flag;
            }
            return(result);
        }
Example #7
0
 public static bool IsMailboxInDatabase(ExRpcAdmin rpcAdmin, Guid mdbGuid, Guid mailboxGuid)
 {
     PropValue[][] mailboxTableInfo;
     try
     {
         mailboxTableInfo = rpcAdmin.GetMailboxTableInfo(mdbGuid, mailboxGuid, new PropTag[]
         {
             PropTag.UserGuid,
             PropTag.MailboxMiscFlags
         });
     }
     catch (MapiExceptionNotFound)
     {
         return(false);
     }
     if (mailboxTableInfo != null)
     {
         foreach (PropValue[] array2 in mailboxTableInfo)
         {
             if (array2 != null && array2.Length == 2 && array2[0].PropTag == PropTag.UserGuid)
             {
                 byte[] bytes = array2[0].GetBytes();
                 Guid   a     = (bytes != null && bytes.Length == 16) ? new Guid(bytes) : Guid.Empty;
                 if (a == mailboxGuid)
                 {
                     MailboxMiscFlags mailboxMiscFlags = (MailboxMiscFlags)((array2[1].PropTag == PropTag.MailboxMiscFlags) ? array2[1].GetInt() : 0);
                     if ((mailboxMiscFlags & MailboxMiscFlags.SoftDeletedMailbox) == MailboxMiscFlags.None)
                     {
                         return(true);
                     }
                     return(false);
                 }
             }
         }
     }
     return(false);
 }
        public IPhysicalMailbox ToPhysicalMailbox()
        {
            MailboxMiscFlags           propertyValue       = this.GetPropertyValue <MailboxMiscFlags>(MailboxTablePropertyDefinitions.MailboxMiscFlags);
            Guid                       propertyValue2      = this.GetPropertyValue <Guid>(MailboxTablePropertyDefinitions.MailboxGuid);
            TenantPartitionHintAdapter tenantPartitionHint = this.GetTenantPartitionHint();
            ByteQuantifiedSize         sizeProperty        = this.GetSizeProperty(MailboxTablePropertyDefinitions.TotalItemSize);
            ByteQuantifiedSize         sizeProperty2       = this.GetSizeProperty(MailboxTablePropertyDefinitions.TotalDeletedItemSize);
            ByteQuantifiedSize         byteQuantifiedSize  = sizeProperty + sizeProperty2;
            ByteQuantifiedSize         sizeProperty3       = this.GetSizeProperty(MailboxTablePropertyDefinitions.MessageTableTotalSize);
            ByteQuantifiedSize         sizeProperty4       = this.GetSizeProperty(MailboxTablePropertyDefinitions.AttachmentTableTotalSize);
            ByteQuantifiedSize         sizeProperty5       = this.GetSizeProperty(MailboxTablePropertyDefinitions.OtherTablesTotalSize);
            ByteQuantifiedSize         byteQuantifiedSize2 = sizeProperty3 + sizeProperty4 + sizeProperty5;
            bool                       propertyValue3      = this.GetPropertyValue <bool>(MailboxTablePropertyDefinitions.IsQuarantined);
            StoreMailboxType           propertyValue4      = this.GetPropertyValue <StoreMailboxType>(MailboxTablePropertyDefinitions.StoreMailboxType);
            uint?                      propertyValue5      = this.GetPropertyValue <uint?>(MailboxTablePropertyDefinitions.ItemCount);
            DateTime?                  propertyValue6      = this.GetPropertyValue <DateTime?>(MailboxTablePropertyDefinitions.LastLogonTime);
            DateTime?                  propertyValue7      = this.GetPropertyValue <DateTime?>(MailboxTablePropertyDefinitions.DisconnectDate);
            DirectoryIdentity          identity            = DirectoryIdentity.CreateMailboxIdentity(propertyValue2, tenantPartitionHint, DirectoryObjectType.Mailbox);
            ByteQuantifiedSize         totalLogicalSize    = byteQuantifiedSize;
            ByteQuantifiedSize         totalPhysicalSize   = byteQuantifiedSize2;
            bool                       isQuarantined       = propertyValue3;
            StoreMailboxType           mailboxType         = propertyValue4;
            uint?                      num = propertyValue5;

            return(new PhysicalMailbox(identity, totalLogicalSize, totalPhysicalSize, isQuarantined, mailboxType, ((num != null) ? new ulong?((ulong)num.GetValueOrDefault()) : null) ?? 0UL, propertyValue6, propertyValue7, tenantPartitionHint.IsConsumer, propertyValue.HasFlag(MailboxMiscFlags.SoftDeletedMailbox) || propertyValue.HasFlag(MailboxMiscFlags.MRSSoftDeletedMailbox), propertyValue.HasFlag(MailboxMiscFlags.ArchiveMailbox), propertyValue.HasFlag(MailboxMiscFlags.DisabledMailbox), propertyValue.HasFlag(MailboxMiscFlags.CreatedByMove))
            {
                OrganizationId = tenantPartitionHint.ExternalDirectoryOrganizationId,
                MessageTableTotalSize = sizeProperty3,
                OtherTablesTotalSize = sizeProperty5,
                AttachmentTableTotalSize = sizeProperty4,
                TotalItemSize = sizeProperty,
                TotalDeletedItemSize = sizeProperty2,
                ItemsPendingUpgrade = this.GetPropertyValue <int>(MailboxTablePropertyDefinitions.ItemsPendingUpgrade),
                CreationTimestamp = this.GetPropertyValue <DateTime>(MailboxTablePropertyDefinitions.CreationTime)
            });
        }
        protected override List <MailboxData> GetMailboxesForCurrentWindow(out int totalMailboxOnDatabaseCount, out int notInterestingMailboxCount, out int filteredMailboxCount, out int failedFilteringCount)
        {
            Guid activityId = Guid.NewGuid();

            PropTag[]     mailboxProperties = this.GetMailboxProperties();
            PropValue[][] mailboxes         = MailboxTableQuery.GetMailboxes("Client=TBA", base.DatabaseInfo, mailboxProperties);
            totalMailboxOnDatabaseCount = ((mailboxes == null) ? 0 : mailboxes.Length);
            notInterestingMailboxCount  = 0;
            filteredMailboxCount        = 0;
            failedFilteringCount        = 0;
            AssistantsLog.LogGetMailboxesQueryEvent(activityId, base.Assistant.NonLocalizedName, totalMailboxOnDatabaseCount, base.Assistant as AssistantBase);
            if (mailboxes == null)
            {
                return(new List <MailboxData>());
            }
            List <MailboxInformation> list3 = new List <MailboxInformation>(mailboxes.Length);
            Guid mailboxGuid = Guid.Empty;
            VariantConfigurationSnapshot snapshot    = VariantConfiguration.GetSnapshot(DatabaseSettingsContext.Get(base.DatabaseInfo.Guid), null, null);
            TimeSpan notInterestingLogInterval       = snapshot.MailboxAssistants.GetObject <IMailboxAssistantSettings>(base.AssistantType.Identifier, new object[0]).MailboxNotInterestingLogInterval;
            int      filteredMailboxCountLocal       = 0;
            int      notInterestingMailboxCountLocal = 0;
            string   traceMessage;

            foreach (PropValue[] propertiesForDelegateClosure2 in mailboxes)
            {
                try
                {
                    PropValue[] propertiesForDelegateClosure = propertiesForDelegateClosure2;
                    List <MailboxInformation> list           = list3;
                    base.CatchMeIfYouCan(delegate
                    {
                        PropValue mailboxProperty  = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.UserGuid);
                        PropValue mailboxProperty2 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.DisplayName);
                        string mailboxDisplayNameTracingOnlyUsage = (mailboxProperty2.IsNull() || mailboxProperty2.Value == null) ? string.Empty : mailboxProperty2.Value.ToString();
                        if (mailboxProperty.PropTag != PropTag.UserGuid || mailboxProperty2.PropTag != PropTag.DisplayName)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxNoGuidFilter, MailboxSlaFilterReasonType.NoGuid, new object[]
                            {
                                mailboxProperty.Value
                            });
                            filteredMailboxCountLocal++;
                            return;
                        }
                        byte[] bytes = mailboxProperty.GetBytes();
                        if (bytes != null && bytes.Length == 16)
                        {
                            mailboxGuid = new Guid(bytes);
                        }
                        if (MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.DateDiscoveredAbsentInDS).PropTag == PropTag.DateDiscoveredAbsentInDS)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxNotInDirectoryFilter, MailboxSlaFilterReasonType.NotInDirectory, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        PropValue mailboxProperty3 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.MailboxMiscFlags);
                        MailboxMiscFlags @int      = (MailboxMiscFlags)mailboxProperty3.GetInt(0);
                        if ((@int & MailboxMiscFlags.CreatedByMove) == MailboxMiscFlags.CreatedByMove)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxMoveDestinationFilter, MailboxSlaFilterReasonType.MoveDestination, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        MailboxMiscFlags mailboxMiscFlags = @int & (MailboxMiscFlags.DisabledMailbox | MailboxMiscFlags.SoftDeletedMailbox | MailboxMiscFlags.MRSSoftDeletedMailbox);
                        if (mailboxMiscFlags != MailboxMiscFlags.None)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxInaccessibleFilter, MailboxSlaFilterReasonType.Inaccessible, new object[]
                            {
                                mailboxMiscFlags
                            });
                            filteredMailboxCountLocal++;
                            return;
                        }
                        IMailboxFilter mailboxFilter = this.AssistantType as IMailboxFilter;
                        if (mailboxFilter != null && mailboxProperty3.PropTag == PropTag.MailboxMiscFlags)
                        {
                            MailboxMiscFlags int2 = (MailboxMiscFlags)mailboxProperty3.GetInt();
                            bool flag             = (int2 & MailboxMiscFlags.ArchiveMailbox) == MailboxMiscFlags.ArchiveMailbox;
                            if (flag && !mailboxFilter.MailboxType.Contains(MailboxType.Archive))
                            {
                                this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxArchiveFilter, MailboxSlaFilterReasonType.Archive, new object[0]);
                                filteredMailboxCountLocal++;
                                return;
                            }
                        }
                        ControlData controlData = ControlData.Empty;
                        if (this.AssistantType.ControlDataPropertyDefinition != null)
                        {
                            PropValue mailboxProperty4 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, (PropTag)this.AssistantType.ControlDataPropertyDefinition.PropertyTag);
                            if (mailboxProperty4.PropTag == (PropTag)this.AssistantType.ControlDataPropertyDefinition.PropertyTag)
                            {
                                controlData = ControlData.CreateFromByteArray(mailboxProperty4.GetBytes());
                            }
                        }
                        TenantPartitionHint tenantPartitionHint = null;
                        PropValue mailboxProperty5 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.PersistableTenantPartitionHint);
                        if (mailboxProperty5.PropTag == PropTag.PersistableTenantPartitionHint)
                        {
                            byte[] bytes2 = mailboxProperty5.GetBytes();
                            if (bytes2 != null && bytes2.Length != 0)
                            {
                                tenantPartitionHint = TenantPartitionHint.FromPersistablePartitionHint(bytes2);
                            }
                        }
                        MailboxInformation mailboxInformation2 = MailboxInformation.Create(mailboxProperty.GetBytes(), this.DatabaseInfo.Guid, mailboxProperty2.GetString(), controlData, propertiesForDelegateClosure, MailboxInformation.GetLastLogonTime(propertiesForDelegateClosure), tenantPartitionHint);
                        if (!this.DatabaseInfo.IsUserMailbox(mailboxInformation2.MailboxGuid))
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxNotUserFilter, MailboxSlaFilterReasonType.NotUser, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        if (mailboxInformation2.MailboxData.IsPublicFolderMailbox && (mailboxFilter == null || !mailboxFilter.MailboxType.Contains(MailboxType.PublicFolder)))
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxPublicFolderFilter, MailboxSlaFilterReasonType.PublicFolder, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        if (this.IsMailboxInDemandJob(mailboxInformation2.MailboxData))
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxInDemandJobFilter, MailboxSlaFilterReasonType.InDemandJob, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        if (this.AssistantType.MailboxExtendedProperties != null)
                        {
                            if (!this.AssistantType.IsMailboxInteresting(mailboxInformation2))
                            {
                                traceMessage = string.Format("{0}: {1} is not interesting for the assistant {2}.", this, mailboxGuid, this.Assistant.NonLocalizedName);
                                ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
                                DateTime utcNow = DateTime.UtcNow;
                                if (!this.notInterestingEventsLastLogDateTimes.ContainsKey(this.Assistant.NonLocalizedName) || utcNow - this.notInterestingEventsLastLogDateTimes[this.Assistant.NonLocalizedName] >= notInterestingLogInterval)
                                {
                                    AssistantsLog.LogMailboxNotInterestingEvent(activityId, this.Assistant.NonLocalizedName, this.Assistant as AssistantBase, mailboxGuid, mailboxDisplayNameTracingOnlyUsage);
                                    this.notInterestingEventsLastLogDateTimes[this.Assistant.NonLocalizedName] = utcNow;
                                }
                                notInterestingMailboxCountLocal++;
                                return;
                            }
                        }
                        else
                        {
                            traceMessage = string.Format("{0}: {1} mailbox properties are null, IsMailboxInteresting was not called.", this, mailboxGuid);
                            ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
                        }
                        traceMessage = string.Format("{0}: {1} is interesting for the assistant {2}.", this, mailboxGuid, this.Assistant.NonLocalizedName);
                        ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
                        AssistantsLog.LogMailboxInterestingEvent(activityId, this.Assistant.NonLocalizedName, this.Assistant as AssistantBase, null, mailboxGuid, mailboxDisplayNameTracingOnlyUsage);
                        list.Add(mailboxInformation2);
                    }, base.AssistantType.NonLocalizedName);
                }
                catch (AIException exception)
                {
                    failedFilteringCount++;
                    AssistantsLog.LogErrorEnumeratingMailboxes(base.Assistant, mailboxGuid, exception, true);
                }
                catch (Exception exception2)
                {
                    AssistantsLog.LogErrorEnumeratingMailboxes(base.Assistant, mailboxGuid, exception2, false);
                    throw;
                }
            }
            traceMessage = string.Format("{0}: {1} mailboxes after filtering", this, list3.Count);
            ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
            if (this.firstIteration || base.AssistantType.WorkCycleCheckpoint < base.AssistantType.WorkCycle)
            {
                int count = list3.Count;
                list3 = list3.FindAll((MailboxInformation mailbox) => DateTime.UtcNow - mailbox.LastProcessedDate > base.AssistantType.WorkCycle - base.AssistantType.WorkCycleCheckpoint);
                this.firstIteration        = false;
                filteredMailboxCountLocal += count - list3.Count;
            }
            list3.Sort((MailboxInformation m1, MailboxInformation m2) => m1.LastProcessedDate.CompareTo(m2.LastProcessedDate));
            List <MailboxData> list2 = new List <MailboxData>();

            foreach (MailboxInformation mailboxInformation in list3)
            {
                list2.Add(mailboxInformation.MailboxData);
            }
            AssistantsLog.LogEndGetMailboxesEvent(activityId, base.Assistant.NonLocalizedName, list2.Count, base.Assistant as AssistantBase);
            filteredMailboxCount       = filteredMailboxCountLocal;
            notInterestingMailboxCount = notInterestingMailboxCountLocal;
            return(list2);
        }
Example #10
0
 public PhysicalMailbox(DirectoryIdentity identity, ByteQuantifiedSize totalLogicalSize, ByteQuantifiedSize totalPhysicalSize, bool isQuarantined, MailboxMiscFlags mailboxFlags, StoreMailboxType mailboxType, ulong itemCount, DateTime?lastLogonTimestamp) : this(identity, totalLogicalSize, totalPhysicalSize, isQuarantined, mailboxType, itemCount, lastLogonTimestamp, null, false, mailboxFlags.HasFlag(MailboxMiscFlags.SoftDeletedMailbox) || mailboxFlags.HasFlag(MailboxMiscFlags.MRSSoftDeletedMailbox), mailboxFlags.HasFlag(MailboxMiscFlags.ArchiveMailbox), mailboxFlags.HasFlag(MailboxMiscFlags.DisabledMailbox), mailboxFlags.HasFlag(MailboxMiscFlags.CreatedByMove))
 {
 }