protected override void InternalValidate() { TaskLogger.LogEnter(); try { if (MapiTaskHelper.IsDatacenter) { base.CurrentOrganizationId = MapiTaskHelper.ResolveTargetOrganization(base.DomainController, this.Organization, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId); base.RescopeToOrgId(base.CurrentOrganizationId); base.OrganizationId = base.CurrentOrganizationId; } else { base.OrganizationId = OrganizationId.ForestWideOrgId; } this.DisallowPublicFolderMoveDuringFinalization(); this.targetMailboxUser = (ADUser)base.GetDataObject <ADUser>(this.TargetMailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.TargetMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.TargetMailbox.ToString())), ExchangeErrorCategory.Client); TenantPublicFolderConfigurationCache.Instance.RemoveValue(base.CurrentOrganizationId); TenantPublicFolderConfiguration value = TenantPublicFolderConfigurationCache.Instance.GetValue(base.CurrentOrganizationId); if (value.GetLocalMailboxRecipient(this.targetMailboxUser.ExchangeGuid) == null) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotMovePublicFolderIntoNonPublicFolderMailbox), ErrorCategory.InvalidArgument, this.targetMailboxUser); } string text = this.GetSourceMailboxGuid().ToString(); this.sourceMailboxUser = (ADUser)base.GetDataObject <ADUser>(MailboxIdParameter.Parse(text), base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(text)), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(text)), ExchangeErrorCategory.Client); if (this.sourceMailboxUser.ExchangeGuid == this.targetMailboxUser.ExchangeGuid) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotMovePublicFolderIntoSameMailbox), ErrorCategory.InvalidArgument, this.targetMailboxUser); } if (!string.IsNullOrEmpty(base.Name)) { base.ValidateName(); base.RequestName = base.Name; } else { base.RequestName = "PublicFolderMove"; } ADObjectId mdbId = null; ADObjectId mdbServerSite = null; base.Flags = (RequestFlags.IntraOrg | this.LocateAndChooseMdb(value.GetLocalMailboxRecipient(this.sourceMailboxUser.ExchangeGuid).Database, value.GetLocalMailboxRecipient(this.targetMailboxUser.ExchangeGuid).Database, this.sourceMailboxUser, this.targetMailboxUser, this.targetMailboxUser, out mdbId, out mdbServerSite)); if (base.WorkloadType == RequestWorkloadType.None) { base.WorkloadType = RequestWorkloadType.Local; } base.MdbId = mdbId; base.MdbServerSite = mdbServerSite; base.WriteVerbose(Strings.RequestQueueIdentified(base.MdbId.Name)); this.CheckRequestNameAvailability(null, null, false, MRSRequestType.PublicFolderMove, this.Organization, false); base.WriteVerbose(Strings.RequestNameAvailabilityComplete); base.InternalValidate(); } finally { TaskLogger.LogExit(); } }
private void ValidateCSV() { Stream stream = null; try { Stream stream2; if (this.CSVStream != null) { stream2 = this.CSVStream; } else { stream2 = new MemoryStream(this.CSVData); stream = stream2; } PublicFolderMigrationRequestCsvSchema publicFolderMigrationRequestCsvSchema = new PublicFolderMigrationRequestCsvSchema(); publicFolderMigrationRequestCsvSchema.PropertyValidationError += delegate(CsvRow row, string columnName, PropertyValidationError error) { base.WriteError(new RecipientTaskException(Strings.ErrorParsingCSV(row.Index, columnName, error.Description)), ExchangeErrorCategory.Client, null); }; Dictionary <string, Guid> dictionary = new Dictionary <string, Guid>(); Dictionary <string, Guid> dictionary2 = null; bool flag = false; foreach (CsvRow csvRow in publicFolderMigrationRequestCsvSchema.Read(stream2)) { if (csvRow.Index != 0) { if (!flag) { dictionary2 = this.CreateMailboxNameToGuidMap(); flag = true; } string text = csvRow["FolderPath"]; string identity = csvRow["TargetMailbox"]; MailboxIdParameter mailboxIdParameter = MailboxIdParameter.Parse(identity); ADUser aduser = (ADUser)base.GetDataObject <ADUser>(mailboxIdParameter, this.recipientSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(mailboxIdParameter.ToString()))); if (dictionary.ContainsKey(text)) { base.WriteError(new RecipientTaskException(Strings.ErrorParsingCSV(csvRow.Index, "FolderPath", "DuplicateFolderPathEntry")), ExchangeErrorCategory.Client, null); } else if (!dictionary2.ContainsValue(aduser.ExchangeGuid)) { base.WriteError(new RecipientTaskException(Strings.ErrorParsingCSV(csvRow.Index, "TargetMailbox", "InvalidPublicFolderMailbox")), ExchangeErrorCategory.Client, null); } dictionary.Add(text, aduser.ExchangeGuid); this.folderToMailboxMapping.Add(new FolderToMailboxMapping(text, aduser.ExchangeGuid)); } } if (!flag) { base.WriteError(new RecipientTaskException(Strings.ErrorParsingCSV(1, "FolderPath", "NoInputDataFound")), ExchangeErrorCategory.Client, null); } } finally { if (stream != null) { stream.Dispose(); stream = null; } } }