protected override MultiValuedProperty <byte[]> RetrievePersistedPageTokens(MsoTenantCookieContainer container) { if (container == null) { throw new ArgumentNullException("container"); } return(container.MsoForwardSyncRecipientCookie); }
public override void ClearCookie() { MsoTenantCookieContainer msoTenantCookieContainer = this.configSession.GetMsoTenantCookieContainer(base.ContextId); if (msoTenantCookieContainer != null) { MultiValuedProperty <byte[]> multiValuedProperty = this.RetrievePersistedPageTokens(msoTenantCookieContainer); multiValuedProperty.Clear(); if (multiValuedProperty.Changed) { this.configSession.Save(msoTenantCookieContainer); } this.LogClearPageTokenEvent(); } }
public override byte[] ReadCookie() { MsoTenantCookieContainer msoTenantCookieContainer = this.configSession.GetMsoTenantCookieContainer(base.ContextId); if (msoTenantCookieContainer == null) { return(null); } MultiValuedProperty <byte[]> multiValuedProperty = this.RetrievePersistedPageTokens(msoTenantCookieContainer); if (multiValuedProperty.Count == 0) { return(null); } base.LastCookie = MsoFullSyncCookie.FromStorageCookie(multiValuedProperty[0]); return(base.LastCookie.RawCookie); }
internal MsoTenantSyncRequest(MsoTenantCookieContainer organization, MsoFullSyncCookie recipientCookie, MsoFullSyncCookie companyCookie) : base(new SimpleProviderPropertyBag()) { this.propertyBag.SetField(this.propertyBag.ObjectVersionPropertyDefinition, ExchangeObjectVersion.Exchange2010); this.propertyBag.SetField(this.propertyBag.ObjectIdentityPropertyDefinition, organization.Identity); this.ExternalDirectoryOrganizationId = organization.ExternalDirectoryOrganizationId; this.ServiceInstanceId = organization.DirSyncServiceInstance; MsoFullSyncCookie msoFullSyncCookie = recipientCookie ?? companyCookie; if (msoFullSyncCookie != null) { this.SyncType = msoFullSyncCookie.SyncType; this.Requestor = msoFullSyncCookie.SyncRequestor; this.WhenCreated = ((msoFullSyncCookie.WhenSyncRequested != DateTime.MinValue) ? new DateTime?(msoFullSyncCookie.WhenSyncRequested) : null); this.WhenSyncStarted = ((msoFullSyncCookie.WhenSyncStarted != DateTime.MinValue) ? new DateTime?(msoFullSyncCookie.WhenSyncStarted) : null); if (recipientCookie != null) { this.WhenLastRecipientCookieCommitted = ((recipientCookie.Timestamp != DateTime.MinValue) ? new DateTime?(recipientCookie.Timestamp) : null); } if (companyCookie != null) { this.WhenLastCompanyCookieCommitted = ((companyCookie.Timestamp != DateTime.MinValue) ? new DateTime?(companyCookie.Timestamp) : null); } } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); string requestor = this.GetRequestor(); if (this.Full) { if (base.ShouldProcess(this.ConfirmationMessage)) { this.recipientFullSyncCookieManager.WriteInitialSyncCookie(TenantSyncType.Full, requestor); this.companyFullSyncCookieManager.WriteInitialSyncCookie(TenantSyncType.Full, requestor); } } else { this.recipientFullSyncCookieManager.WriteInitialSyncCookie(TenantSyncType.Partial, requestor); this.companyFullSyncCookieManager.WriteInitialSyncCookie(TenantSyncType.Partial, requestor); } MsoTenantCookieContainer organization = (MsoTenantCookieContainer)base.DataSession.Read <MsoTenantCookieContainer>(this.DataObject.Identity); MsoTenantSyncRequest sendToPipeline = new MsoTenantSyncRequest(organization, this.recipientFullSyncCookieManager.LastCookie, this.companyFullSyncCookieManager.LastCookie); base.WriteObject(sendToPipeline); TaskLogger.LogExit(); }
protected abstract MultiValuedProperty <byte[]> RetrievePersistedPageTokens(MsoTenantCookieContainer container);
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); this.DataObject.AutoCompletionEnabled = this.AutoCompletionEnabled; this.DataObject.LargeTenantModeEnabled = this.LargeTenantModeEnabled; this.DataObject.SafeLockdownSchedule = (this.SafeLockdownSchedule ?? Schedule.Always); if (base.Fields.IsModified(TenantRelocationRequestSchema.RelocationStateRequested)) { this.DataObject.RelocationStateRequested = (RelocationStateRequested)this.RelocationStateRequested; } this.DataObject.TargetForest = this.targetAccountPartitionFqdn; this.sourceForestRIDMaster = ForestTenantRelocationsCache.GetRidMasterName(this.sourceAccountPartitionId); DirectorySessionFactory @default = DirectorySessionFactory.Default; Fqdn domainController = base.DomainController; ITenantConfigurationSession tenantConfigurationSession = @default.CreateTenantConfigurationSession((domainController != null) ? domainController : this.sourceForestRIDMaster, false, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromAllTenantsPartitionId(this.sourceAccountPartitionId), 334, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Relocation\\NewTenantRelocationRequest.cs"); PartitionId partitionId = new PartitionId(this.targetAccountPartitionFqdn); this.targetForestRIDMaster = ForestTenantRelocationsCache.GetRidMasterName(partitionId); ITenantConfigurationSession tenantConfigurationSession2 = DirectorySessionFactory.Default.CreateTenantConfigurationSession(this.targetForestRIDMaster, false, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 343, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Relocation\\NewTenantRelocationRequest.cs"); tenantConfigurationSession2.SessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants; MsoTenantCookieContainer msoTenantCookieContainer = tenantConfigurationSession2.GetMsoTenantCookieContainer(this.externalDirectoryOrganizationId); if (msoTenantCookieContainer != null && !NewTenantRelocationRequest.IntraForestRelocationEnabled()) { InvalidOperationException exception = new InvalidOperationException(Strings.ErrorTargetPartitionHasTenantWithSameId(this.DataObject.DistinguishedName, this.targetAccountPartitionFqdn, msoTenantCookieContainer.DistinguishedName, this.DataObject.ExternalDirectoryOrganizationId)); base.WriteError(exception, ErrorCategory.InvalidOperation, this.DataObject.Identity); } string text = this.GetInitialDomainName(tenantConfigurationSession, this.DataObject.OrganizationId); ExchangeConfigurationUnit exchangeConfigurationUnitByName = tenantConfigurationSession2.GetExchangeConfigurationUnitByName(text); if (exchangeConfigurationUnitByName != null) { if (text.Length > 50) { text = text.Substring(0, 50); } text = string.Format("{0}-RELO-{1}", text, Guid.NewGuid().ToString()); if (text.Length > 64) { text = text.Substring(0, 64); } } Exception ex; OrganizationId targetSharedOrgId = SharedConfiguration.FindMostRecentSharedConfigurationInPartition(this.DataObject.OrganizationId, partitionId, out ex); if (ex != null) { base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject.Identity); } ADOrganizationalUnit adorganizationalUnit = null; bool useConfigNC = tenantConfigurationSession.UseConfigNC; try { tenantConfigurationSession.UseConfigNC = false; adorganizationalUnit = tenantConfigurationSession.Read <ADOrganizationalUnit>(this.DataObject.OrganizationId.OrganizationalUnit); } finally { tenantConfigurationSession.UseConfigNC = useConfigNC; } this.DataObject.RelocationStatusDetailsRaw = RelocationStatusDetails.InitializationStarted; base.InternalProcessRecord(); ADObjectId enclosureContainerId = this.CreateEnclosureConfigContainer(text, tenantConfigurationSession2); ExchangeConfigurationUnit exchangeConfigurationUnit = this.CreateOrgConfigurationContainer(enclosureContainerId, targetSharedOrgId, this.DataObject.ExternalDirectoryOrganizationId, this.DataObject.ProgramId, this.DataObject.OfferId, this.DataObject.IsDehydrated, this.DataObject.IsStaticConfigurationShared, this.sourceForestFqdn, this.DataObject.Guid, this.DataObject.ExchangeObjectId, tenantConfigurationSession2); ADObjectId organizationalUnitLink = this.CreateOrganizationUnitContainer(text, adorganizationalUnit.Guid, adorganizationalUnit.ExchangeObjectId, tenantConfigurationSession2); exchangeConfigurationUnit.OrganizationalUnitLink = organizationalUnitLink; exchangeConfigurationUnit.RelocationStatusDetailsRaw = RelocationStatusDetails.InitializationFinished; tenantConfigurationSession2.Save(exchangeConfigurationUnit); this.DataObject.RelocationStatusDetailsRaw = RelocationStatusDetails.InitializationFinished; base.DataSession.Save(this.DataObject); TenantRelocationRequest tenantRelocationRequest = (TenantRelocationRequest)base.DataSession.Read <TenantRelocationRequest>(this.DataObject.Identity); TenantRelocationRequest targetForestObject = tenantConfigurationSession2.Read <TenantRelocationRequest>(exchangeConfigurationUnit.Id); TenantRelocationRequest.PopulatePresentationObject(tenantRelocationRequest, targetForestObject); GetTenantRelocationRequest.PopulateGlsProperty(tenantRelocationRequest, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); GetTenantRelocationRequest.PopulateRidMasterProperties(tenantRelocationRequest, this.sourceForestRIDMaster, this.targetForestRIDMaster, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); if (tenantRelocationRequest.OriginatingServer != this.sourceForestRIDMaster) { this.WriteWarning(Strings.WarningShouldWriteToRidMaster(tenantRelocationRequest.OriginatingServer, this.sourceForestRIDMaster)); } base.WriteObject(tenantRelocationRequest); TaskLogger.LogExit(); }