Example #1
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);
 }
        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)
            });
        }
 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))
 {
 }