protected override bool ValidateTargetMailbox(MailboxInformation mailboxInfo, out LocalizedString moveFinishedReason)
        {
            Organization orgContainer = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(this.publicFolderConfiguration.OrganizationId), 314, "ValidateTargetMailbox", "f:\\15.00.1497\\sources\\dev\\mrs\\src\\Service\\MRSJobs\\PublicFolderMigrationJob.cs").GetOrgContainer();

            moveFinishedReason = MrsStrings.ReportTargetPublicFolderDeploymentUnlocked;
            return(orgContainer.DefaultPublicFolderMailbox.Type == PublicFolderInformation.HierarchyType.InTransitMailboxGuid);
        }
Ejemplo n.º 2
0
 public override void ValidateAndPopulateRequestJob(List <ReportEntry> entries)
 {
     base.ConfigureMailboxProviders();
     if (base.CachedRequestJob.TargetIsLocal || !base.CachedRequestJob.SkipInitialConnectionValidation)
     {
         this.MailboxMerger.ConnectDestinationMailbox(MailboxConnectFlags.ValidateOnly);
         base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulTargetConnection, new DateTime?(DateTime.UtcNow));
         base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.TargetConnectionFailure, null);
         MailboxServerInformation mailboxServerInformation = this.MailboxMerger.DestMailbox.GetMailboxServerInformation();
         MailboxInformation       mailboxInformation       = this.MailboxMerger.DestMailbox.GetMailboxInformation();
         if (mailboxInformation != null && mailboxInformation.ServerVersion != 0)
         {
             base.CachedRequestJob.TargetVersion = mailboxInformation.ServerVersion;
             base.CachedRequestJob.TargetServer  = ((mailboxServerInformation != null) ? mailboxServerInformation.MailboxServerName : null);
         }
     }
     this.AfterTargetConnect();
     if (base.CachedRequestJob.SourceIsLocal || !base.CachedRequestJob.SkipInitialConnectionValidation)
     {
         this.MailboxMerger.ConnectSourceMailbox(MailboxConnectFlags.ValidateOnly);
         base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulSourceConnection, new DateTime?(DateTime.UtcNow));
         base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.SourceConnectionFailure, null);
         MailboxServerInformation mailboxServerInformation2 = this.MailboxMerger.SourceMailbox.GetMailboxServerInformation();
         MailboxInformation       mailboxInformation2       = this.MailboxMerger.SourceMailbox.GetMailboxInformation();
         if (mailboxInformation2 != null && mailboxInformation2.ServerVersion != 0)
         {
             base.CachedRequestJob.SourceVersion = mailboxInformation2.ServerVersion;
             base.CachedRequestJob.SourceServer  = ((mailboxServerInformation2 != null) ? mailboxServerInformation2.MailboxServerName : null);
         }
     }
 }
Ejemplo n.º 3
0
 internal MailboxSizeRec(MailboxInformation mailboxInfo)
 {
     this.ItemCount           = mailboxInfo.RegularItemCount;
     this.ItemSize            = mailboxInfo.RegularItemsSize;
     this.FAIItemCount        = mailboxInfo.AssociatedItemCount;
     this.FAIItemSize         = mailboxInfo.AssociatedItemsSize;
     this.DeletedItemCount    = mailboxInfo.RegularDeletedItemCount;
     this.DeletedItemSize     = mailboxInfo.RegularDeletedItemsSize;
     this.DeletedFAIItemCount = mailboxInfo.AssociatedDeletedItemCount;
     this.DeletedFAIItemSize  = mailboxInfo.AssociatedDeletedItemsSize;
 }
Ejemplo n.º 4
0
        MailboxInformation IMailbox.GetMailboxInformation()
        {
            MailboxInformation result = null;

            base.CreateContext("IMailbox.GetMailboxInformation", new DataContext[0]).Execute(delegate
            {
                result = this.WrappedObject.GetMailboxInformation();
            }, true);
            if (result != null)
            {
                this.mailboxVersion = new int?(result.ServerVersion);
            }
            return(result);
        }
Ejemplo n.º 5
0
 internal ConnectivityRec(ServerKind serverKind, MailboxInformation mailboxInfo, MailboxServerInformation serverInfo)
 {
     this.ServerKind    = serverKind;
     this.ServerName    = serverInfo.MailboxServerName;
     this.ServerVersion = new ServerVersion(serverInfo.MailboxServerVersion);
     if (serverInfo.ProxyServerName != null)
     {
         this.ProxyName    = serverInfo.ProxyServerName;
         this.ProxyVersion = serverInfo.ProxyServerVersion.ServerVersion;
     }
     if (mailboxInfo != null)
     {
         this.ProviderName = mailboxInfo.ProviderName;
     }
 }
Ejemplo n.º 6
0
        bool IMailbox.IsMailboxCapabilitySupported(MailboxCapabilities capability)
        {
            MrsTracer.ProxyClient.Function("RemoteMailbox.IsMailboxCapabilitySupported({0})", new object[]
            {
                capability
            });
            bool result;

            if (this.mailboxCapabilities.TryGetValue(capability, out result))
            {
                return(result);
            }
            this.VerifyMailboxConnection();
            if (capability == MailboxCapabilities.FolderRules && this is RemoteDestinationMailbox)
            {
                MailboxInformation mailboxInformation = ((IMailbox)this).GetMailboxInformation();
                if (mailboxInformation != null)
                {
                    this.mailboxCapabilities[capability] = (mailboxInformation.ServerVersion >= Server.E14MinVersion);
                    return(this.mailboxCapabilities[capability]);
                }
            }
            if (capability == MailboxCapabilities.FolderRules || capability == MailboxCapabilities.FolderAcls)
            {
                this.mailboxCapabilities[capability] = true;
                if (base.ServerVersion[60])
                {
                    this.mailboxCapabilities[capability] = base.MrsProxy.IMailbox_IsMailboxCapabilitySupported2(base.Handle, (int)capability);
                }
                return(this.mailboxCapabilities[capability]);
            }
            if (base.ServerVersion[47])
            {
                this.mailboxCapabilities[capability] = base.MrsProxy.IMailbox_IsMailboxCapabilitySupported2(base.Handle, (int)capability);
                return(this.mailboxCapabilities[capability]);
            }
            if (base.ServerVersion[43] && (capability == MailboxCapabilities.PagedEnumerateChanges || capability == MailboxCapabilities.PagedGetActions || capability == MailboxCapabilities.ReplayActions))
            {
                this.mailboxCapabilities[capability] = base.MrsProxy.IMailbox_IsMailboxCapabilitySupported(base.Handle, capability);
                return(this.mailboxCapabilities[capability]);
            }
            this.mailboxCapabilities[capability] = false;
            return(this.mailboxCapabilities[capability]);
        }
Ejemplo n.º 7
0
        public override void ValidateAndPopulateRequestJob(List <ReportEntry> entries)
        {
            this.ConfigureProviders(false);
            MailboxServerInformation mailboxServerInformation = null;
            MailboxInformation       mailboxInformation       = null;

            this.ConnectSource(this.folderMover, out mailboxServerInformation, out mailboxInformation);
            if (mailboxInformation != null && mailboxInformation.ServerVersion != 0)
            {
                base.CachedRequestJob.SourceVersion = mailboxInformation.ServerVersion;
                base.CachedRequestJob.SourceServer  = ((mailboxServerInformation != null) ? mailboxServerInformation.MailboxServerName : null);
            }
            this.ConnectDestination(this.folderMover, out mailboxServerInformation, out mailboxInformation);
            if (mailboxInformation != null && mailboxInformation.ServerVersion != 0)
            {
                base.CachedRequestJob.TargetVersion = mailboxInformation.ServerVersion;
                base.CachedRequestJob.TargetServer  = ((mailboxServerInformation != null) ? mailboxServerInformation.MailboxServerName : null);
            }
        }
        public override void ValidateAndPopulateRequestJob(List <ReportEntry> entries)
        {
            this.InternalConfigureProviders(false);
            MailboxServerInformation mailboxServerInformation;
            MailboxInformation       mailboxInformation;

            PublicFolderMigrationJob.ConnectAndValidateSource(this.sourceDatabases, out mailboxServerInformation, out mailboxInformation);
            base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulSourceConnection, new DateTime?(DateTime.UtcNow));
            base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.SourceConnectionFailure, null);
            MailboxServerInformation mailboxServerInformation2 = null;
            MailboxInformation       mailboxInformation2       = null;

            foreach (PublicFolderMigrator publicFolderMigrator in this.publicFolderMigrators.Values)
            {
                MailboxServerInformation mailboxServerInformation3;
                MailboxInformation       mailboxInformation3;
                PublicFolderMigrationJob.ConnectAndValidateDestination(publicFolderMigrator.DestMailbox, MailboxConnectFlags.ValidateOnly, out mailboxServerInformation3, out mailboxInformation3);
                bool flag = publicFolderMigrator.TargetMailboxGuid == this.publicFolderConfiguration.GetHierarchyMailboxInformation().HierarchyMailboxGuid;
                if (flag)
                {
                    MrsTracer.Service.Debug("PublicFolderMigrator for hierarchy mailbox created, with dumpster creation by {0}.", new object[]
                    {
                        publicFolderMigrator.DestMailbox.IsCapabilitySupported(MRSProxyCapabilities.CanStoreCreatePFDumpster) ? "Store" : "MRS"
                    });
                    mailboxServerInformation2 = mailboxServerInformation3;
                    mailboxInformation2       = mailboxInformation3;
                }
            }
            base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulTargetConnection, new DateTime?(DateTime.UtcNow));
            base.CachedRequestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.TargetConnectionFailure, null);
            if (mailboxInformation != null && mailboxInformation.ServerVersion != 0)
            {
                base.CachedRequestJob.SourceVersion = mailboxInformation.ServerVersion;
                base.CachedRequestJob.SourceServer  = ((mailboxServerInformation != null) ? mailboxServerInformation.MailboxServerName : null);
            }
            if (mailboxInformation2 != null && mailboxInformation2.ServerVersion != 0)
            {
                base.CachedRequestJob.TargetVersion = mailboxInformation2.ServerVersion;
                base.CachedRequestJob.TargetServer  = ((mailboxServerInformation2 != null) ? mailboxServerInformation2.MailboxServerName : null);
            }
        }
Ejemplo n.º 9
0
 protected virtual void StartMerge()
 {
     MrsTracer.Service.Debug("WorkItem: StartMerge", new object[0]);
     base.CheckServersHealth();
     base.Report.Append(MrsStrings.ReportRequestStarted);
     MailboxReplicationService.LogEvent(MRSEventLogConstants.Tuple_MoveStarted, new object[]
     {
         base.RequestJobIdentity,
         base.RequestJobGuid.ToString(),
         base.CachedRequestJob.SourceMDBName,
         base.CachedRequestJob.TargetMDBName,
         base.CachedRequestJob.Flags.ToString()
     });
     this.MailboxMerger.SyncState    = new PersistedSyncData(base.RequestJobGuid);
     this.MailboxMerger.ICSSyncState = new MailboxMapiSyncState();
     if (base.TimeTracker.GetTimestamp(RequestJobTimestamp.Start) == null)
     {
         base.TimeTracker.SetTimestamp(RequestJobTimestamp.Start, new DateTime?(DateTime.UtcNow));
     }
     if (base.CachedRequestJob.IgnoreRuleLimitErrors)
     {
         MailboxInformation mailboxInformation = this.MailboxMerger.SourceMailbox.GetMailboxInformation();
         if (mailboxInformation != null && mailboxInformation.RulesSize > 32768)
         {
             MailboxInformation mailboxInformation2 = this.MailboxMerger.DestMailbox.GetMailboxInformation();
             if (mailboxInformation2 != null && mailboxInformation2.ServerVersion < Server.E2007MinVersion)
             {
                 base.Report.Append(MrsStrings.ReportRulesWillNotBeCopied);
             }
         }
     }
     base.SyncStage                = SyncStage.CreatingFolderHierarchy;
     base.OverallProgress          = 5;
     base.TimeTracker.CurrentState = RequestState.CreatingFolderHierarchy;
     base.SaveState(SaveStateFlags.Regular, null);
     base.ScheduleWorkItem(new Action(this.AnalyzeFolderHierarchy), WorkloadType.Unknown);
 }
        public MailboxInformation GetMailboxInformation(TransactionalRequestJob requestJob, Guid primaryMailboxGuid, Guid physicalMailboxGuid, TenantPartitionHint partitionHint, Guid targetMdbGuid, string targetMdbName, string remoteHostName, string remoteOrgName, string remoteDCName, NetworkCredential cred)
        {
            MailboxInformation result = null;

            this.CallService(delegate()
            {
                string username = (cred != null) ? cred.UserName : null;
                string password = (cred != null) ? cred.Password : null;
                string domain   = (cred != null) ? cred.Domain : null;
                if (this.ServerVersion[11])
                {
                    string requestJobXml = XMLSerializableBase.Serialize(new RequestJobXML(requestJob), false);
                    result = this.Channel.GetMailboxInformation4(requestJobXml, primaryMailboxGuid, physicalMailboxGuid, (partitionHint != null) ? partitionHint.GetPersistablePartitionHint() : null, targetMdbGuid, targetMdbName, remoteHostName, remoteOrgName, remoteDCName, username, password, domain);
                    return;
                }
                if (this.ServerVersion[4])
                {
                    result = this.Channel.GetMailboxInformation3(primaryMailboxGuid, physicalMailboxGuid, (partitionHint != null) ? partitionHint.GetPersistablePartitionHint() : null, targetMdbGuid, targetMdbName, remoteHostName, remoteOrgName, remoteDCName, username, password, domain);
                    return;
                }
                result = this.Channel.GetMailboxInformation2(primaryMailboxGuid, physicalMailboxGuid, targetMdbGuid, targetMdbName, remoteHostName, remoteOrgName, remoteDCName, username, password, domain);
            });
            return(result);
        }
 private static void ConnectAndValidateDestination(IDestinationMailbox destinationMailboxes, MailboxConnectFlags connectFlags, out MailboxServerInformation destinationHierarchyMailboxServerInfo, out MailboxInformation destinationHierarchyMailboxInfo)
 {
     destinationMailboxes.Connect(connectFlags);
     destinationHierarchyMailboxServerInfo = destinationMailboxes.GetMailboxServerInformation();
     destinationHierarchyMailboxInfo       = destinationMailboxes.GetMailboxInformation();
 }
        private static void ConnectAndValidateSource(ISourceMailbox sourceDatabase, out MailboxServerInformation sourceMailboxServerInfo, out MailboxInformation sourceDatabaseInfo)
        {
            sourceDatabase.Connect(MailboxConnectFlags.None);
            sourceMailboxServerInfo = sourceDatabase.GetMailboxServerInformation();
            sourceDatabaseInfo      = sourceDatabase.GetMailboxInformation();
            MrsTracer.Service.Debug("Switching source public folder database {0} to SyncSource mode.", new object[]
            {
                sourceDatabaseInfo
            });
            bool flag;

            sourceDatabase.SetInTransitStatus(InTransitStatus.SyncSource, out flag);
            if (!flag)
            {
                throw new OfflinePublicFolderMigrationNotSupportedException();
            }
        }
        MailboxInformation IMailboxReplicationService.GetMailboxInformation4(string requestJobXml, Guid primaryMailboxGuid, Guid physicalMailboxGuid, byte[] partitionHint, Guid targetMdbGuid, string targetMdbName, string remoteHostName, string remoteOrgName, string remoteDCName, string username, string password, string domain)
        {
            MailboxInformation info = null;

            this.ForwardKnownExceptions(delegate
            {
                TenantPartitionHint partitionHint2 = (partitionHint != null) ? TenantPartitionHint.FromPersistablePartitionHint(partitionHint) : null;
                bool flag = string.IsNullOrEmpty(targetMdbName) && targetMdbGuid == Guid.Empty;
                NetworkCredential networkCredential = (!string.IsNullOrEmpty(username)) ? new NetworkCredential(username, password, domain) : null;
                MailboxType mbxType;
                IMailbox mailbox;
                if (string.IsNullOrEmpty(remoteHostName))
                {
                    if (!string.IsNullOrEmpty(remoteDCName))
                    {
                        if (flag)
                        {
                            mbxType = MailboxType.SourceMailbox;
                            mailbox = new MapiSourceMailbox(LocalMailboxFlags.Move);
                        }
                        else
                        {
                            mbxType = MailboxType.DestMailboxIntraOrg;
                            mailbox = new MapiDestinationMailbox(LocalMailboxFlags.None);
                        }
                        mailbox.ConfigADConnection(remoteDCName, remoteDCName, networkCredential);
                    }
                    else
                    {
                        ProxyServerSettings proxyServerSettings;
                        if (targetMdbGuid != Guid.Empty)
                        {
                            proxyServerSettings = CommonUtils.MapDatabaseToProxyServer(targetMdbGuid);
                        }
                        else
                        {
                            proxyServerSettings = CommonUtils.MapMailboxToProxyServer(new Guid?(physicalMailboxGuid), new Guid?(primaryMailboxGuid), partitionHint);
                        }
                        if (flag)
                        {
                            if (proxyServerSettings.Scenario == ProxyScenarios.LocalMdbAndProxy)
                            {
                                mailbox = new StorageSourceMailbox(LocalMailboxFlags.Move);
                            }
                            else
                            {
                                mailbox = new RemoteSourceMailbox(proxyServerSettings.Fqdn, null, null, ProxyControlFlags.DoNotApplyProxyThrottling, null, false, LocalMailboxFlags.Move);
                            }
                            mbxType = MailboxType.SourceMailbox;
                        }
                        else
                        {
                            if (proxyServerSettings.Scenario == ProxyScenarios.LocalMdbAndProxy)
                            {
                                mailbox = new StorageDestinationMailbox(LocalMailboxFlags.Move);
                            }
                            else
                            {
                                mailbox = new RemoteDestinationMailbox(proxyServerSettings.Fqdn, null, null, ProxyControlFlags.DoNotApplyProxyThrottling, null, false, LocalMailboxFlags.Move);
                            }
                            mbxType = MailboxType.DestMailboxIntraOrg;
                        }
                    }
                }
                else
                {
                    ProxyControlFlags proxyControlFlags = ProxyControlFlags.DoNotApplyProxyThrottling;
                    RequestJobXML requestJobXML         = XMLSerializableBase.Deserialize <RequestJobXML>(requestJobXml, true);
                    if (requestJobXML != null)
                    {
                        using (TransactionalRequestJob transactionalRequestJob = new TransactionalRequestJob(requestJobXML))
                        {
                            transactionalRequestJob.IsFake = true;
                            proxyControlFlags |= transactionalRequestJob.GetProxyControlFlags();
                        }
                    }
                    if (flag)
                    {
                        mailbox = new RemoteSourceMailbox(remoteHostName, remoteOrgName, networkCredential, proxyControlFlags, null, true, LocalMailboxFlags.Move);
                        mbxType = MailboxType.SourceMailbox;
                    }
                    else
                    {
                        mailbox = new RemoteDestinationMailbox(remoteHostName, remoteOrgName, networkCredential, proxyControlFlags, null, true, LocalMailboxFlags.Move);
                        mbxType = MailboxType.DestMailboxCrossOrg;
                    }
                }
                using (mailbox)
                {
                    mailbox.Config(null, primaryMailboxGuid, physicalMailboxGuid, partitionHint2, targetMdbGuid, mbxType, null);
                    if (!string.IsNullOrEmpty(targetMdbName))
                    {
                        mailbox.ConfigMDBByName(targetMdbName);
                    }
                    mailbox.Connect(MailboxConnectFlags.None);
                    using (SettingsContextBase.ActivateContext(mailbox as ISettingsContextProvider))
                    {
                        info          = mailbox.GetMailboxInformation();
                        ADUser aduser = mailbox.GetADUser();
                        if (!this.clientVersion[2] && aduser.HasSeparatedArchive)
                        {
                            throw new UnsupportedClientVersionPermanentException(this.clientVersion.ComputerName, this.clientVersion.ToString(), "ArchiveSeparation");
                        }
                        info.UserDataXML       = ConfigurableObjectXML.Serialize <ADUser>(aduser);
                        info.ServerInformation = mailbox.GetMailboxServerInformation();
                        mailbox.Disconnect();
                    }
                }
            }, null);
            return(info);
        }
Ejemplo n.º 14
0
 protected override bool ValidateTargetMailbox(MailboxInformation mailboxInfo, out LocalizedString moveFinishedReason)
 {
     moveFinishedReason = MrsStrings.ReportTargetAuxFolderContentMailboxGuidUpdated;
     return(true);
 }
Ejemplo n.º 15
0
        protected override void MakeConnections()
        {
            Exception sourceConnectFailure = null;
            Exception targetConnectFailure = null;
            int       sourceVersion        = 0;
            int       targetVersion        = 0;
            string    sourceServerName     = null;
            string    targetServerName     = null;

            CommonUtils.CatchKnownExceptions(delegate
            {
                MrsTracer.Service.Debug("Attempting to connect to the destination mailbox {0}.", new object[]
                {
                    this.MailboxMerger.TargetTracingID
                });
                this.MailboxMerger.ConnectDestinationMailbox(MailboxConnectFlags.None);
            }, delegate(Exception failure)
            {
                MrsTracer.Service.Warning("Failed to connect to destination mailbox: {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(failure)
                });
                targetConnectFailure = failure;
            });
            if (targetConnectFailure == null)
            {
                MailboxServerInformation mailboxServerInformation = this.MailboxMerger.DestMailbox.GetMailboxServerInformation();
                MailboxInformation       mailboxInformation       = this.MailboxMerger.DestMailbox.GetMailboxInformation();
                this.MailboxMerger.TargetServerInfo = mailboxServerInformation;
                if (mailboxServerInformation != null)
                {
                    ConnectivityRec connectivityRec = new ConnectivityRec(ServerKind.Target, mailboxInformation, mailboxServerInformation);
                    base.Report.Append(MrsStrings.ReportDestinationMailboxConnection(this.MailboxMerger.TargetTracingID, mailboxServerInformation.ServerInfoString, (mailboxInformation != null) ? mailboxInformation.MdbName : "(null)"), connectivityRec);
                    targetServerName = mailboxServerInformation.MailboxServerName;
                    targetVersion    = mailboxServerInformation.MailboxServerVersion;
                }
                if (!this.MailboxMerger.DestMailbox.MailboxExists())
                {
                    throw new MailboxDoesNotExistPermanentException(this.MailboxMerger.TargetTracingID);
                }
                MrsTracer.Service.Debug("Destination mailbox {0} exists.", new object[]
                {
                    this.MailboxMerger.TargetTracingID
                });
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulTargetConnection, new DateTime?(DateTime.UtcNow));
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.TargetConnectionFailure, null);
                this.MailboxMerger.LoadSyncState(base.Report);
            }
            if (targetConnectFailure == null)
            {
                this.AfterTargetConnect();
            }
            CommonUtils.CatchKnownExceptions(delegate
            {
                MrsTracer.Service.Debug("Connecting to the source mailbox {0}.", new object[]
                {
                    this.MailboxMerger.SourceTracingID
                });
                this.MailboxMerger.ConnectSourceMailbox(MailboxConnectFlags.None);
            }, delegate(Exception failure)
            {
                MrsTracer.Service.Warning("Failed to connect to source mailbox: {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(failure)
                });
                sourceConnectFailure = failure;
            });
            if (sourceConnectFailure == null)
            {
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulSourceConnection, new DateTime?(DateTime.UtcNow));
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.SourceConnectionFailure, null);
                MailboxServerInformation mailboxServerInformation2 = this.MailboxMerger.SourceMailbox.GetMailboxServerInformation();
                MailboxInformation       mailboxInformation2       = this.MailboxMerger.SourceMailbox.GetMailboxInformation();
                this.MailboxMerger.SourceServerInfo = mailboxServerInformation2;
                if (mailboxServerInformation2 != null)
                {
                    ConnectivityRec connectivityRec2 = new ConnectivityRec(ServerKind.Source, mailboxInformation2, mailboxServerInformation2);
                    base.Report.Append(MrsStrings.ReportSourceMailboxConnection(this.MailboxMerger.SourceTracingID, mailboxServerInformation2.ServerInfoString, (mailboxInformation2 != null) ? mailboxInformation2.MdbName : "(null)"), connectivityRec2);
                    sourceServerName = mailboxServerInformation2.MailboxServerName;
                    sourceVersion    = mailboxServerInformation2.MailboxServerVersion;
                }
            }
            if (sourceConnectFailure != null || targetConnectFailure != null)
            {
                base.CheckRequestIsValid();
                if (sourceConnectFailure != null)
                {
                    throw sourceConnectFailure;
                }
                if (targetConnectFailure != null)
                {
                    throw targetConnectFailure;
                }
            }
            base.SaveRequest(true, delegate(TransactionalRequestJob rj)
            {
                this.TimeTracker.SetTimestamp(RequestJobTimestamp.Failure, null);
                this.TimeTracker.SetTimestamp(RequestJobTimestamp.Suspended, null);
                rj.FailureCode   = null;
                rj.FailureType   = null;
                rj.FailureSide   = null;
                rj.Message       = LocalizedString.Empty;
                rj.SourceServer  = sourceServerName;
                rj.SourceVersion = sourceVersion;
                rj.TargetServer  = targetServerName;
                rj.TargetVersion = targetVersion;
                rj.Status        = RequestStatus.InProgress;
                this.TimeTracker.CurrentState = RequestState.InitialSeeding;
                RequestJobLog.Write(rj);
            });
            if (!string.IsNullOrEmpty(base.CachedRequestJob.ContentFilter))
            {
                RestrictionData contentRestriction;
                string          text;
                ContentFilterBuilder.ProcessContentFilter(base.CachedRequestJob.ContentFilter, base.CachedRequestJob.ContentFilterLCID, null, this.MailboxMerger.SourceMailboxWrapper, out contentRestriction, out text);
                this.MailboxMerger.ContentRestriction = contentRestriction;
            }
            if (this.MailboxMerger.SupportsRuleAPIs)
            {
                this.MailboxMerger.SourceMailbox.ConfigMailboxOptions(MailboxOptions.IgnoreExtendedRuleFAIs);
            }
            this.MailboxMerger.ExchangeSourceAndTargetVersions();
            base.ScheduleWorkItem(new Action(this.StartMerge), WorkloadType.Unknown);
        }
Ejemplo n.º 16
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);
        }