示例#1
0
        MailboxInformation IMailbox.GetMailboxInformation()
        {
            MrsTracer.Provider.Function("StorageMailbox.GetMailboxInformation", new object[0]);
            MailboxInformation mailboxInformation = new MailboxInformation();
            MailboxDatabase    mailboxDatabase    = base.FindDatabaseByGuid <MailboxDatabase>(base.MdbGuid);

            mailboxInformation.ProviderName               = "StorageProvider";
            mailboxInformation.MailboxGuid                = base.MailboxGuid;
            mailboxInformation.MdbGuid                    = base.MdbGuid;
            mailboxInformation.MdbName                    = mailboxDatabase.Identity.ToString();
            mailboxInformation.MdbLegDN                   = mailboxDatabase.ExchangeLegacyDN;
            mailboxInformation.MdbQuota                   = (mailboxDatabase.ProhibitSendReceiveQuota.IsUnlimited ? null : new ulong?(mailboxDatabase.ProhibitSendReceiveQuota.Value.ToBytes()));
            mailboxInformation.MdbDumpsterQuota           = (mailboxDatabase.RecoverableItemsQuota.IsUnlimited ? null : new ulong?(mailboxDatabase.RecoverableItemsQuota.Value.ToBytes()));
            mailboxInformation.ServerVersion              = this.ServerVersion;
            mailboxInformation.ServerMailboxRelease       = base.ServerMailboxRelease.ToString();
            mailboxInformation.RecipientType              = this.recipientType;
            mailboxInformation.RecipientDisplayType       = this.recipientDisplayType;
            mailboxInformation.RecipientTypeDetailsLong   = this.recipientTypeDetails;
            mailboxInformation.MailboxHomeMdbGuid         = (base.IsArchiveMailbox ? base.MbxArchiveMdbGuid : base.MbxHomeMdbGuid);
            mailboxInformation.ArchiveGuid                = this.archiveGuid;
            mailboxInformation.AlternateMailboxes         = this.alternateMailboxes;
            mailboxInformation.UseMdbQuotaDefaults        = this.useMdbQuotaDefaults;
            mailboxInformation.MailboxQuota               = this.mbxQuota;
            mailboxInformation.MailboxDumpsterQuota       = this.mbxDumpsterQuota;
            mailboxInformation.MailboxArchiveQuota        = this.mbxArchiveQuota;
            mailboxInformation.MailboxIdentity            = ((base.MailboxId != null) ? base.MailboxId.ToString() : null);
            mailboxInformation.MailboxItemCount           = 0UL;
            mailboxInformation.MailboxSize                = 0UL;
            mailboxInformation.RegularItemCount           = 0UL;
            mailboxInformation.RegularDeletedItemCount    = 0UL;
            mailboxInformation.AssociatedItemCount        = 0UL;
            mailboxInformation.AssociatedDeletedItemCount = 0UL;
            mailboxInformation.RegularItemsSize           = 0UL;
            mailboxInformation.RegularDeletedItemsSize    = 0UL;
            mailboxInformation.AssociatedItemsSize        = 0UL;
            mailboxInformation.AssociatedDeletedItemsSize = 0UL;
            mailboxInformation.RulesSize                  = 0;
            mailboxInformation.MrsVersion                 = CommonUtils.GetEffectiveMrsVersion();
            int intValueAndDecrement = base.TestIntegration.GetIntValueAndDecrement("SimulatePushMove", 0, 0, int.MaxValue);

            if (intValueAndDecrement > 0)
            {
                if (intValueAndDecrement % 2 == 0)
                {
                    mailboxInformation.MrsVersion = 99.9f;
                }
                else
                {
                    mailboxInformation.MrsVersion = 99.8f;
                }
            }
            if (this.StoreSession != null)
            {
                object[] properties;
                using (base.RHTracker.Start())
                {
                    NativeStorePropertyDefinition[] array = this.ConvertPropTagsToDefinitions(MailboxProviderBase.MailboxInformationPropertyTags);
                    this.StoreSession.Mailbox.Load(array);
                    properties = this.StoreSession.Mailbox.GetProperties(array);
                }
                for (int i = 0; i < properties.Length; i++)
                {
                    object obj = properties[i];
                    if (obj != null && !(obj is PropertyError))
                    {
                        MailboxProviderBase.PopulateMailboxInformation(mailboxInformation, MailboxProviderBase.MailboxInformationPropertyTags[i], obj);
                    }
                }
                if (!base.IsPublicFolderMailbox)
                {
                    using (base.RHTracker.Start())
                    {
                        try
                        {
                            MailboxSession mailboxSession = this.GetMailboxSession();
                            using (CoreFolder coreFolder = CoreFolder.Bind(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox)))
                            {
                                coreFolder.PropertyBag.Load(StorageMailbox.InboxProperties);
                                object obj2 = coreFolder.PropertyBag.TryGetProperty(FolderSchema.FolderRulesSize);
                                if (obj2 is int)
                                {
                                    mailboxInformation.RulesSize = (int)obj2;
                                }
                                object obj3 = coreFolder.PropertyBag.TryGetProperty(FolderSchema.ContentAggregationFlags);
                                if (obj3 is int)
                                {
                                    mailboxInformation.ContentAggregationFlags = (int)obj3;
                                }
                                else
                                {
                                    mailboxInformation.ContentAggregationFlags = 0;
                                }
                            }
                        }
                        catch (ObjectNotFoundException)
                        {
                            MrsTracer.Provider.Debug("Inbox not found for mailbox '{0}'", new object[]
                            {
                                base.MdbGuid
                            });
                        }
                    }
                }
            }
            using (ExRpcAdmin rpcAdmin = base.GetRpcAdmin())
            {
                using (base.RHTracker.Start())
                {
                    mailboxInformation.MailboxTableFlags = (int)MapiUtils.GetMailboxTableFlags(rpcAdmin, base.MdbGuid, base.MailboxGuid);
                }
            }
            return(mailboxInformation);
        }