public object Create(DataTable table) { MailboxStatistics mailboxStatistics = new MailboxStatistics(); mailboxStatistics.Dispose(); return(mailboxStatistics); }
internal bool GetMailboxQuarantineStatus() { if (this.mapiSession == null) { this.mapiSession = new MapiAdministrationSession(this.DbLocationInfo.ServerLegacyDN, Fqdn.Parse(this.DbLocationInfo.ServerFqdn)); } StoreMailboxIdParameter id = StoreMailboxIdParameter.Parse(this.exchangeGuid.ToString()); bool isQuarantined; using (MailboxStatistics mailboxStatistics = (MailboxStatistics)base.GetDataObject <MailboxStatistics>(id, this.mapiSession, MapiTaskHelper.ConvertDatabaseADObjectToDatabaseId(this.database), new LocalizedString?(Strings.ErrorStoreMailboxNotFound(this.Identity.ToString(), this.Database.Identity.ToString())), new LocalizedString?(Strings.ErrorStoreMailboxNotUnique(this.Identity.ToString(), this.Database.Identity.ToString())))) { isQuarantined = mailboxStatistics.IsQuarantined; } return(isQuarantined); }
public static void MailboxUsageGetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; Mailbox mailbox = store.GetDataObject("Mailbox") as Mailbox; if (mailbox != null) { MailboxStatistics mailboxStatistics = store.GetDataObject("MailboxStatistics") as MailboxStatistics; MailboxDatabase mailboxDatabase = store.GetDataObject("MailboxDatabase") as MailboxDatabase; MailboxStatistics archiveStatistics = store.GetDataObject("ArchiveStatistics") as MailboxStatistics; MailboxPropertiesHelper.MailboxUsage mailboxUsage = new MailboxPropertiesHelper.MailboxUsage(mailbox, mailboxDatabase, mailboxStatistics, archiveStatistics); dataRow["MailboxUsage"] = new StatisticsBarData(mailboxUsage.MailboxUsagePercentage, mailboxUsage.MailboxUsageState, mailboxUsage.MailboxUsageText); if ((mailbox.UseDatabaseQuotaDefaults != null && mailbox.UseDatabaseQuotaDefaults.Value && mailboxDatabase != null && !Util.IsDataCenter) || !mailbox.ProhibitSendQuota.IsUnlimited) { dataRow["IsMailboxUsageUnlimited"] = false; } else { dataRow["IsMailboxUsageUnlimited"] = true; } Unlimited <ByteQuantifiedSize> maxReceiveSize = mailbox.MaxReceiveSize; if (maxReceiveSize.IsUnlimited) { dataRow["MaxReceiveSize"] = "unlimited"; } else { dataRow["MaxReceiveSize"] = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(maxReceiveSize); } dataRow["IssueWarningQuota"] = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(mailboxUsage.IssueWarningQuota); dataRow["ProhibitSendQuota"] = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(mailboxUsage.ProhibitSendQuota); dataRow["ProhibitSendReceiveQuota"] = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(mailboxUsage.ProhibitSendReceiveQuota); dataRow["RetainDeletedItemsFor"] = mailboxUsage.RetainDeletedItemsFor.Days.ToString(); dataRow["RetainDeletedItemsUntilBackup"] = mailboxUsage.RetainDeletedItemsUntilBackup; } }
// Token: 0x06000F15 RID: 3861 RVA: 0x00059E04 File Offset: 0x00058004 public static Unlimited <ByteQuantifiedSize> GetTotalItemSize(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState) { Unlimited <ByteQuantifiedSize> totalItemSize = ByteQuantifiedSize.Zero; string value = string.Format("{0}\\{1}", organizationId.OrganizationalUnit.Name, mailboxGuid.ToString()); PSCommand cmd = new PSCommand(); cmd.AddCommand("Get-MailboxStatistics"); cmd.AddParameter("NoADLookup"); cmd.AddParameter("Identity", value); MailboxStatistics publicFolderMailboxStatistics = null; PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error) { error = null; originOfException = "GetTotalItemSize - RunPSCommand Get-MailboxStatistics"; IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId); publicFolderMailboxStatistics = assistantRunspaceProxy.RunPSCommand <MailboxStatistics>(cmd, out error, logger); if (error == null && publicFolderMailboxStatistics != null) { totalItemSize = publicFolderMailboxStatistics.TotalItemSize; } }, splitOperationState); return(totalItemSize); }
internal override IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { if (!typeof(MailboxEntry).IsAssignableFrom(typeof(T))) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } if (session == null) { throw new ArgumentNullException("session"); } if (rootId == null) { throw new ArgumentNullException("rootId"); } if (!(session is MapiAdministrationSession)) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(MapiAdministrationSession).Name), "session"); } if (string.IsNullOrEmpty(this.displayName) && null == base.MapiObjectId) { throw new InvalidOperationException(Strings.ErrorOperationOnInvalidObject); } notFoundReason = null; List <T> list = new List <T>(); Guid mailboxGuid = Guid.Empty; if (base.MapiObjectId != null) { mailboxGuid = ((MailboxId)base.MapiObjectId).MailboxGuid; } QueryFilter filter = new MailboxContextFilter(mailboxGuid, this.flags); try { IEnumerable <T> enumerable = session.FindPaged <T>(filter, rootId, true, null, 0); if (null != base.MapiObjectId) { bool flag = Guid.Empty != ((MailboxId)base.MapiObjectId).MailboxGuid; bool flag2 = !string.IsNullOrEmpty(((MailboxId)base.MapiObjectId).MailboxExchangeLegacyDn); if (flag || flag2) { foreach (T t in enumerable) { IConfigurable configurable = t; MailboxEntry mailboxEntry = (MailboxEntry)configurable; if (flag && mailboxEntry.Identity.MailboxGuid == ((MailboxId)base.MapiObjectId).MailboxGuid) { list.Add((T)((object)mailboxEntry)); } else if (flag2 && string.Equals(mailboxEntry.Identity.MailboxExchangeLegacyDn, ((MailboxId)base.MapiObjectId).MailboxExchangeLegacyDn, StringComparison.OrdinalIgnoreCase)) { list.Add((T)((object)mailboxEntry)); } } } } if (list.Count == 0 && typeof(MailboxStatistics).IsAssignableFrom(typeof(T)) && !string.IsNullOrEmpty(this.displayName)) { foreach (T t2 in enumerable) { IConfigurable configurable2 = t2; MailboxStatistics mailboxStatistics = (MailboxStatistics)configurable2; if (string.Equals(this.displayName, mailboxStatistics.DisplayName, StringComparison.OrdinalIgnoreCase)) { list.Add((T)((object)mailboxStatistics)); } } } } catch (MapiObjectNotFoundException) { } return(list); }
public SearchMailboxesResults Search(ISearchPolicy policy, SearchMailboxesInputs input) { long num = 0L; long num2 = 0L; long num3 = 0L; long num4 = 0L; long num5 = 0L; long num6 = 0L; ulong num7 = 0UL; SortedResultPage resultPage = null; MultiMailboxSearchClient multiMailboxSearchClient = null; ResultAggregator resultAggregator = new ResultAggregator(); ByteQuantifiedSize byteQuantifiedSize = new ByteQuantifiedSize(0UL); List <MailboxStatistics> list = new List <MailboxStatistics>(); Dictionary <Guid, List <KeyValuePair <int, long> > > dictionary = new Dictionary <Guid, List <KeyValuePair <int, long> > >(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Recorder.Record record = policy.Recorder.Start("SearchResultProvider", TraceType.InfoTrace, true); Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "FastLocalSearchResultsProvider.Search Input:", input, "Type:", input.SearchType }); SearchMailboxesResults result; try { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search Initializing"); num3 = stopwatch.ElapsedMilliseconds; string str = (input.PagingInfo != null && input.PagingInfo.SortBy != null && input.PagingInfo.SortBy.SortOrder == SortOrder.Ascending) ? "+" : "-"; string str2 = (input.PagingInfo != null && input.PagingInfo.SortValue != null && input.PagingInfo.SortValue.SortColumn == ItemSchema.DocumentId) ? "[docid]" : FastIndexSystemSchema.Received.Name; AdditionalParameters additionalParameters = new AdditionalParameters { Sort = str + str2, Refiners = new string[] { FastIndexSystemSchema.Size.Name } }; long referenceDocId = 0L; PaginationQueryFilter pagingFilter = null; QueryFilter queryFilter = input.Criteria.Query; if (input.PagingInfo != null && input.PagingInfo.SortValue != null) { referenceDocId = input.PagingInfo.SortValue.SecondarySortValue; if (input.PagingInfo.SortValue.SortColumnValue != null && input.PagingInfo.SortValue.SortColumn != ItemSchema.DocumentId) { pagingFilter = new PaginationQueryFilter(input.PagingInfo); } } SearchSource searchSource = input.Sources.FirstOrDefault <SearchSource>(); if (searchSource != null) { Guid guid = searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveDatabase : searchSource.MailboxInfo.MdbGuid; string displayName = FlowDescriptor.GetImsFlowDescriptor(FastLocalSearchResultsProvider.SearchConfig, FastIndexVersion.GetIndexSystemName(guid)).DisplayName; num4 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "FastLocalSearchResultsProvider.Search Initialized DB:", guid, "Flow:", displayName }); List <SearchSource> list2 = new List <SearchSource>(input.Sources); while (list2.Count > 0) { HashSet <Guid> hashSet = new HashSet <Guid>(); List <SearchSource> list3 = new List <SearchSource>(); int i = 0; while (i < list2.Count) { SearchSource searchSource2 = list2[i]; Guid item = searchSource2.MailboxInfo.IsArchive ? searchSource2.MailboxInfo.ArchiveGuid : searchSource2.MailboxInfo.MailboxGuid; if (!hashSet.Contains(item)) { list3.Add(searchSource2); list2.RemoveAt(i); hashSet.Add(item); } else { i++; } } multiMailboxSearchClient = new MultiMailboxSearchClient(guid, (from s in list3 select s.MailboxInfo).ToArray <MailboxInfo>(), input.Criteria, input.CallerInfo, input.PagingInfo); foreach (SearchSource searchSource3 in list3) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search Searching Source", searchSource3); ulong num8 = 0UL; bool flag = false; MailboxStatistics mailboxStatistics = null; ByteQuantifiedSize byteQuantifiedSize2 = new ByteQuantifiedSize(0UL); List <KeyValuePair <int, long> > list4 = new List <KeyValuePair <int, long> >(); Guid guid2 = searchSource3.MailboxInfo.IsArchive ? searchSource3.MailboxInfo.ArchiveGuid : searchSource3.MailboxInfo.MailboxGuid; queryFilter = this.ApplyFolderFilter(queryFilter, searchSource3.MailboxInfo, multiMailboxSearchClient); string text = FqlQueryBuilder.ToFqlString(queryFilter, input.Criteria.QueryCulture); text = this.ApplyPagingFilter(text, referenceDocId, pagingFilter, input.PagingInfo, input.Criteria.QueryCulture); Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "FastLocalSearchResultsProvider.Search Searching Source Guid:", guid2, "Filter:", queryFilter, "Query:", text }); num6 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; IEnumerable <KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> > enumerable = FastLocalSearchResultsProvider.FlowExecutor.Execute(displayName, guid2, policy.CallerInfo.QueryCorrelationId, text, 0L, input.Criteria.QueryCulture, additionalParameters, Math.Min(FastLocalSearchResultsProvider.SearchConfig.FastQueryResultTrimHits, input.PagingInfo.PageSize), null); foreach (KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> keyValuePair in enumerable) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found pages"); PagingImsFlowExecutor.QueryExecutionContext key = keyValuePair.Key; ISearchResultItem[] value = keyValuePair.Value; if (!flag) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found statistics"); num8 += (ulong)FastLocalSearchResultsProvider.FlowExecutor.ReadHitCount(key); IEnumerable <RefinerResult> source = FastLocalSearchResultsProvider.FlowExecutor.ReadRefiners(key); RefinerResult refinerResult = source.FirstOrDefault((RefinerResult t) => t.Name == FastIndexSystemSchema.Size.Name); if (refinerResult != null) { byteQuantifiedSize2 += new ByteQuantifiedSize((ulong)refinerResult.Sum); } mailboxStatistics = new MailboxStatistics(searchSource3.MailboxInfo, num8, byteQuantifiedSize2); flag = true; } foreach (ISearchResultItem searchResultItem in value) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found items"); IFieldHolder fieldHolder = searchResultItem.Fields.FirstOrDefault((IFieldHolder f) => string.Equals(f.Name, "DocId", StringComparison.InvariantCultureIgnoreCase)); if (fieldHolder != null) { long num9 = (long)fieldHolder.Value; int documentId = IndexId.GetDocumentId(num9); IndexId.GetMailboxNumber(num9); list4.Add(new KeyValuePair <int, long>(documentId, num9)); } } if (list4.Count >= input.PagingInfo.PageSize) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search completed FAST"); break; } } num7 += num8; byteQuantifiedSize += byteQuantifiedSize2; if (list4.Count > 0) { dictionary[guid2] = list4; } if (mailboxStatistics != null) { list.Add(mailboxStatistics); } num += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; } if (dictionary.Count > 0) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search loading preview items"); resultPage = multiMailboxSearchClient.FetchPreviewProperties(dictionary); num2 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; } Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search aggregating"); ISearchResult aggregator = new AggregatedSearchTaskResult(new MailboxInfoList(multiMailboxSearchClient.Mailboxes), resultPage, null, num7, byteQuantifiedSize, null, list, null); resultAggregator.MergeSearchResult(aggregator); num5 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; } } result = new SearchMailboxesResults(input.Sources) { SearchResult = resultAggregator }; } finally { record.Attributes["FAST"] = num; record.Attributes["STORE"] = num2; record.Attributes["REST"] = num6; record.Attributes["INIT"] = num4; record.Attributes["AGGR"] = num5; record.Attributes["TOTALSIZE"] = byteQuantifiedSize; record.Attributes["TOTALCNT"] = num7; policy.Recorder.End(record); } return(result); }
protected override void InternalValidate() { TaskLogger.LogEnter(); try { base.ValidateRootFolders(this.SourceRootFolder, this.TargetRootFolder); bool wildcardedSearch = false; if (!string.IsNullOrEmpty(base.Name)) { base.ValidateName(); base.RequestName = base.Name; } else { wildcardedSearch = true; base.RequestName = "MailboxRestore"; } this.targetUser = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.TargetMailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true); this.CheckForInvalidPublicFolderRestoreParameters(); if (this.targetUser.HasLocalArchive && this.targetUser.RecipientType == RecipientType.MailUser && this.targetUser.Database == null && !this.TargetIsArchive) { base.WriteError(new MissingArchiveParameterForRestorePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } if (this.targetUser.RecipientType != RecipientType.UserMailbox && (!this.TargetIsArchive || this.targetUser.RecipientType != RecipientType.MailUser)) { base.WriteError(new InvalidRecipientTypePermanentException(this.targetUser.ToString(), this.targetUser.RecipientType.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } if (this.TargetIsArchive && (this.targetUser.ArchiveGuid == Guid.Empty || this.targetUser.ArchiveDatabase == null)) { base.WriteError(new MailboxLacksArchivePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetIsArchive); } if (!this.TargetIsArchive && this.targetUser.Database == null) { base.WriteError(new MailboxLacksDatabasePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } if (base.ParameterSetName.Equals("RemoteMailboxRestore")) { if (!Guid.TryParse(this.SourceStoreMailbox.RawIdentity, out this.sourceMailboxGuid)) { base.WriteError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("SourceStoreMailbox")), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } if (!base.Fields.IsModified("AllowLegacyDNMismatch") || !this.AllowLegacyDNMismatch) { base.WriteError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("AllowLegacyDNMismatch")), ErrorCategory.InvalidArgument, this.AllowLegacyDNMismatch); } base.Flags = (RequestFlags.CrossOrg | RequestFlags.Pull); switch (this.RemoteRestoreType) { case RemoteRestoreType.RecoveryDatabase: this.restoreFlags |= MailboxRestoreType.Recovery; this.restoreFlags |= MailboxRestoreType.SoftDeleted; break; case RemoteRestoreType.DisconnectedMailbox: this.restoreFlags |= MailboxRestoreType.SoftDeleted; break; case RemoteRestoreType.SoftDeletedRecipient: this.restoreFlags |= MailboxRestoreType.SoftDeletedRecipient; break; default: base.WriteError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("RemoteRestoreType")), ErrorCategory.InvalidArgument, this.RemoteRestoreType); break; } } else { base.Flags = (RequestFlags.IntraOrg | RequestFlags.Pull); string fqdn; string serverExchangeLegacyDn; ADObjectId adobjectId; int num; MailboxDatabase mailboxDatabase = base.CheckDatabase <MailboxDatabase>(this.SourceDatabase, NewRequest <MailboxRestoreRequest> .DatabaseSide.Source, this.SourceDatabase, out fqdn, out serverExchangeLegacyDn, out adobjectId, out num); if (mailboxDatabase.Recovery) { this.restoreFlags |= MailboxRestoreType.Recovery; } this.sourceDatabase = mailboxDatabase.Id; this.SourceStoreMailbox.Flags |= 1UL; using (MapiSession mapiSession = new MapiAdministrationSession(serverExchangeLegacyDn, Fqdn.Parse(fqdn))) { using (MailboxStatistics mailboxStatistics = (MailboxStatistics)base.GetDataObject <MailboxStatistics>(this.SourceStoreMailbox, mapiSession, MapiTaskHelper.ConvertDatabaseADObjectToDatabaseId(mailboxDatabase), new LocalizedString?(Strings.ErrorStoreMailboxNotFound(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())), new LocalizedString?(Strings.ErrorStoreMailboxNotUnique(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())))) { MailboxState?disconnectReason = mailboxStatistics.DisconnectReason; if (mailboxStatistics.MailboxType == StoreMailboxType.PublicFolderPrimary || mailboxStatistics.MailboxType == StoreMailboxType.PublicFolderSecondary) { this.restoreFlags |= MailboxRestoreType.PublicFolderMailbox; } bool flag = false; if (disconnectReason == null && !mailboxDatabase.Recovery) { mapiSession.Administration.SyncMailboxWithDS(mailboxDatabase.Guid, mailboxStatistics.MailboxGuid); using (MailboxStatistics mailboxStatistics2 = (MailboxStatistics)base.GetDataObject <MailboxStatistics>(this.SourceStoreMailbox, mapiSession, MapiTaskHelper.ConvertDatabaseADObjectToDatabaseId(mailboxDatabase), new LocalizedString?(Strings.ErrorStoreMailboxNotFound(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())), new LocalizedString?(Strings.ErrorStoreMailboxNotUnique(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())))) { disconnectReason = mailboxStatistics2.DisconnectReason; if (disconnectReason == null) { if (this.targetUser.OrganizationId != null && this.targetUser.OrganizationId.OrganizationalUnit != null && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled) { IRecipientSession recipientSession = CommonUtils.CreateRecipientSession(mailboxStatistics.ExternalDirectoryOrganizationId, null, null); ADRecipient adrecipient = this.TargetIsArchive ? recipientSession.FindByExchangeGuidIncludingArchive(mailboxStatistics.MailboxGuid) : recipientSession.FindByExchangeGuid(mailboxStatistics.MailboxGuid); flag = (adrecipient != null && adrecipient.RecipientSoftDeletedStatus != 0); } if (!this.IsPublicFolderMailboxRestore && !flag) { base.WriteError(new CannotRestoreConnectedMailboxPermanentException(this.SourceStoreMailbox.ToString()), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } } } } if (flag) { this.restoreFlags |= MailboxRestoreType.SoftDeletedRecipient; } else if (disconnectReason != null) { if (disconnectReason != MailboxState.SoftDeleted) { this.restoreFlags |= MailboxRestoreType.Disabled; } else { this.restoreFlags |= MailboxRestoreType.SoftDeleted; } } this.sourceMailboxGuid = mailboxStatistics.MailboxGuid; this.sourceMailboxDN = mailboxStatistics.LegacyDN; } } if ((this.TargetIsArchive && this.sourceMailboxGuid == this.targetUser.ArchiveGuid && this.sourceDatabase.Equals(this.targetUser.ArchiveDatabase)) || (!this.TargetIsArchive && this.sourceMailboxGuid == this.targetUser.ExchangeGuid && this.sourceDatabase.Equals(this.targetUser.Database))) { base.WriteError(new CannotRestoreIntoSelfPermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } } if (this.restoreFlags.HasFlag(MailboxRestoreType.PublicFolderMailbox)) { if (this.targetUser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotRestoreFromPublicToPrivateMailbox), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } } else if (this.targetUser.RecipientTypeDetails == RecipientTypeDetails.PublicFolderMailbox) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotRestoreFromPrivateToPublicMailbox), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } base.RescopeToOrgId(this.targetUser.OrganizationId); if (base.ParameterSetName.Equals("RemoteMailboxRestore")) { base.PerRecordReportEntries.Add(new ReportEntry(MrsStrings.ReportRequestAllowedMismatch(base.ExecutingUserIdentity))); } else { base.ValidateLegacyDNMatch(this.sourceMailboxDN, this.targetUser, this.TargetMailbox); } ADObjectId mdbId = null; ADObjectId mdbServerSite = null; this.LocateAndChooseMdb(null, this.TargetIsArchive ? this.targetUser.ArchiveDatabase : this.targetUser.Database, null, this.TargetMailbox, this.TargetMailbox, out mdbId, out mdbServerSite); base.MdbId = mdbId; base.MdbServerSite = mdbServerSite; base.RequestName = this.CheckRequestNameAvailability(base.RequestName, this.targetUser.Id, true, MRSRequestType.MailboxRestore, this.TargetMailbox, wildcardedSearch); base.InternalValidate(); } finally { TaskLogger.LogExit(); } }