// Token: 0x06000DBC RID: 3516 RVA: 0x0002905C File Offset: 0x0002725C internal override IEnumerable <T> PerformSearch <T>(QueryFilter filter, ADObjectId rootId, IDirectorySession session, bool deepSearch) { ADObjectId deletedObjectsContainer = ADSession.GetDeletedObjectsContainer(session.GetDomainNamingContext()); ADPagedReader <RemovedMailbox> adpagedReader = session.FindPagedDeletedObject <RemovedMailbox>(deletedObjectsContainer, QueryScope.OneLevel, filter, null, 0); return((IEnumerable <T>)adpagedReader); }
protected override IEnumerable <ADRawEntry> GetPagedData() { if (this.Cookie == null) { DeletedRecipient item = new DeletedRecipient(); return(new List <ADRawEntry> { item }); } PropertyDefinition[] properties = new PropertyDefinition[] { ADObjectSchema.Id, ADObjectSchema.Name, ADObjectSchema.DistinguishedName, ADObjectSchema.Guid, ADObjectSchema.OrganizationalUnitRoot, ADObjectSchema.ObjectClass, ADObjectSchema.WhenChanged, ADObjectSchema.WhenChangedUTC, ADObjectSchema.WhenCreated, ADObjectSchema.WhenCreatedUTC }; if (this.requireTwoQueries) { IRecipientSession sessionForSoftDeletedObjects = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(base.CurrentOrganizationId, this.DomainController); ADObjectId childId = base.CurrentOrganizationId.OrganizationalUnit.GetChildId("OU", "Soft Deleted Objects"); QueryFilter queryFilter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.IsSoftDeletedByRemove, true); queryFilter = new AndFilter(new QueryFilter[] { queryFilter, SyncTaskHelper.GetDeltaFilter(this.inputCookie) }); this.reader2 = sessionForSoftDeletedObjects.FindPagedADRawEntry(childId, QueryScope.OneLevel, queryFilter, null, this.PageSize, properties); this.reader2.Cookie = this.inputCookie.PageCookie2; base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(sessionForSoftDeletedObjects, typeof(ADRawEntry), queryFilter, null, false)); } IRecipientSession recipientSession = (IRecipientSession)base.DataSession; ADObjectId deletedObjectsContainer = ADSession.GetDeletedObjectsContainer(recipientSession.GetDomainNamingContext()); QueryFilter internalFilter = this.InternalFilter; recipientSession.SessionSettings.SkipCheckVirtualIndex = true; ADPagedReader <ADRawEntry> adpagedReader = recipientSession.FindPagedADRawEntry(deletedObjectsContainer, QueryScope.OneLevel, internalFilter, null, this.PageSize, properties); adpagedReader.IncludeDeletedObjects = true; adpagedReader.Cookie = this.inputCookie.PageCookie; base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(base.DataSession, typeof(ADRawEntry), this.InternalFilter, null, false)); return(adpagedReader); }
private void PackDeletedRecipientInfo(ADRawEntry entry) { string text = (string)entry.propertyBag[ADObjectSchema.DistinguishedName]; int num = text.IndexOf(",OU=Soft Deleted Objects,", StringComparison.OrdinalIgnoreCase); if (-1 != num) { string text2 = (string)entry.propertyBag[ADObjectSchema.Name]; string arg = ((Guid)entry.propertyBag[ADObjectSchema.Guid]).ToString(); string value = string.Format("{0}\nDEL:{1}", text2, arg); entry.propertyBag.SetField(ADObjectSchema.Name, value); ADObjectId deletedObjectsContainer = ADSession.GetDeletedObjectsContainer(((IRecipientSession)base.DataSession).GetDomainNamingContext()); string arg2 = AdName.Escape(text2); string text3 = string.Format("CN={0}\\0ADEL:{1},{2}", arg2, arg, deletedObjectsContainer.DistinguishedName); entry.propertyBag.SetField(ADObjectSchema.DistinguishedName, text3); ADObjectId value2 = new ADObjectId(text3); entry.propertyBag.SetField(ADObjectSchema.Id, value2); } entry.propertyBag.SetField(DeletedObjectSchema.IsDeleted, true); entry.propertyBag.SetField(DeletedObjectSchema.LastKnownParent, entry.propertyBag[ADObjectSchema.OrganizationalUnitRoot]); entry.propertyBag.SetField(ADObjectSchema.OrganizationId, base.CurrentOrganizationId); }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); ADGroup group = (ADGroup)base.PrepareDataObject(); this.flagCloseGroupMemberJoinForNoArbitrationMbx = false; this.flagCloseGroupMemberDepartForNoArbitrationMbx = false; this.UpdateRecipientDisplayType(group); ADObjectId adobjectId; bool flag = base.TryGetExecutingUserId(out adobjectId); if (!this.IgnoreNamingPolicy.IsPresent && (base.UserSpecifiedParameters.IsChanged(ADObjectSchema.Name.Name) || base.UserSpecifiedParameters.IsChanged(MailEnabledRecipientSchema.DisplayName.Name))) { Organization organization; if (group.OrganizationId.ConfigurationUnit == null && group.OrganizationId.OrganizationalUnit == null) { organization = this.ConfigurationSession.GetOrgContainer(); } else { organization = this.ConfigurationSession.Read <ExchangeConfigurationUnit>(group.OrganizationId.ConfigurationUnit); } if (flag) { IRecipientSession recipientSession = RecipientTaskHelper.CreatePartitionOrRootOrgScopedGcSession(null, adobjectId); ADUser user = (ADUser)recipientSession.Read(adobjectId); if (base.UserSpecifiedParameters.IsChanged(ADObjectSchema.Name.Name)) { group.Name = DistributionGroupTaskHelper.GetGroupNameWithNamingPolicy(organization, user, group, group.Name, ADObjectSchema.Name, new Task.ErrorLoggerDelegate(base.WriteError)); } if (base.UserSpecifiedParameters.IsChanged(MailEnabledRecipientSchema.DisplayName.Name)) { group.DisplayName = DistributionGroupTaskHelper.GetGroupNameWithNamingPolicy(organization, user, group, group.DisplayName, ADRecipientSchema.DisplayName, new Task.ErrorLoggerDelegate(base.WriteError)); } } } bool flag2 = false; ADScopeException ex = null; if (flag && adobjectId != null && !((IDirectorySession)base.DataSession).TryVerifyIsWithinScopes(group, true, out ex)) { group.IsExecutingUserGroupOwner = true; flag2 = true; base.WriteVerbose(Strings.VerboseDGOwnershipDeepSearch(adobjectId.ToString(), group.Identity.ToString())); RecipientTaskHelper.ValidateUserIsGroupManager(adobjectId, group, delegate(LocalizedException exception, ExchangeErrorCategory category, object taget) { group.IsExecutingUserGroupOwner = false; }, true, base.TenantGlobalCatalogSession); group.propertyBag.ResetChangeTracking(ADGroupSchema.IsExecutingUserGroupOwner); } if (group.RecipientDisplayType == RecipientDisplayType.SecurityDistributionGroup && !flag2 && !this.BypassSecurityGroupManagerCheck && (base.Fields.IsChanged(DistributionGroupSchema.ManagedBy) || base.Fields.IsChanged(MailEnabledRecipientSchema.GrantSendOnBehalfTo) || base.Fields.IsChanged(ADObjectSchema.Name) || base.Fields.IsChanged(DistributionGroupSchema.SamAccountName))) { if (!flag) { base.WriteError(new RecipientTaskException(Strings.ErrorExecutingUserOutOfTargetOrg(base.MyInvocation.MyCommand.Name)), ExchangeErrorCategory.Client, group.Identity.ToString()); } RecipientTaskHelper.ValidateUserIsGroupManager(adobjectId, group, new Task.ErrorLoggerDelegate(base.WriteError), true, base.TenantGlobalCatalogSession); group.IsExecutingUserGroupOwner = true; group.propertyBag.ResetChangeTracking(ADGroupSchema.IsExecutingUserGroupOwner); } base.SetMultiReferenceParameter <GeneralRecipientIdParameter>(DistributionGroupSchema.ManagedBy, this.ManagedBy, group, new GetRecipientDelegate <GeneralRecipientIdParameter>(this.GetRecipient)); if (base.Fields.IsModified(ADGroupSchema.MemberJoinRestriction)) { group.MemberJoinRestriction = this.MemberJoinRestriction; } if (base.Fields.IsModified(ADGroupSchema.MemberDepartRestriction)) { group.MemberDepartRestriction = this.MemberDepartRestriction; } if (base.Fields.IsModified(ADRecipientSchema.ArbitrationMailbox)) { if (base.ArbitrationMailbox == null) { base.WriteError(new RecipientTaskException(Strings.ErrorNullParameter(ADRecipientSchema.ArbitrationMailbox.Name)), ExchangeErrorCategory.Client, group.Identity); } ADObjectId arbitrationMailbox = group.ArbitrationMailbox; } if (!group.ExchangeVersion.IsOlderThan(ADRecipientSchema.ArbitrationMailbox.VersionAdded) && (group.ArbitrationMailbox == null || group.ArbitrationMailbox.IsDescendantOf(ADSession.GetDeletedObjectsContainer(group.ArbitrationMailbox.DomainId)))) { group.ArbitrationMailbox = MailboxTaskHelper.GetArbitrationMailbox(base.TenantGlobalCatalogSession, group.ConfigurationUnit ?? base.RootOrgContainerId); if (group.ArbitrationMailbox == null) { if (group.MemberJoinRestriction == MemberUpdateType.ApprovalRequired) { if (base.Fields.IsModified(ADGroupSchema.MemberJoinRestriction)) { base.WriteError(new RecipientTaskException(Strings.ErrorArbitrationMbxNotSetForApproval(this.Identity.ToString())), ExchangeErrorCategory.Client, group.Identity); } else { group.MemberJoinRestriction = MemberUpdateType.Closed; this.flagCloseGroupMemberJoinForNoArbitrationMbx = true; } } if (group.MemberDepartRestriction == MemberUpdateType.ApprovalRequired) { if (base.Fields.IsModified(ADGroupSchema.MemberDepartRestriction)) { base.WriteError(new RecipientTaskException(Strings.ErrorArbitrationMbxNotSetForApproval(this.Identity.ToString())), ExchangeErrorCategory.Client, group.Identity); } else { group.MemberDepartRestriction = MemberUpdateType.Closed; this.flagCloseGroupMemberDepartForNoArbitrationMbx = true; } } } } TaskLogger.LogExit(); return(group); }
public ADRawEntry[] FindDeletedADRawEntryByUsnRange(ADObjectId lastKnownParentId, long startUsn, int sizeLimit, IEnumerable <PropertyDefinition> properties) { if (sizeLimit > ADDataSession.RangedValueDefaultPageSize) { throw new ArgumentOutOfRangeException("sizeLimit"); } QueryFilter filter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ADRecipientSchema.UsnChanged, startUsn), new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.OrganizationalUnitRoot, lastKnownParentId) }); ADObjectId rootId = ADSession.IsTenantConfigInDomainNC(base.SessionSettings.GetAccountOrResourceForestFqdn()) ? ADSession.GetDeletedObjectsContainer(lastKnownParentId.DomainId) : ADSession.GetDeletedObjectsContainer(base.ConfigurationNamingContext); return(base.Find <ADRawEntry>(rootId, QueryScope.OneLevel, filter, ADDataSession.SortByUsn, sizeLimit, properties, true)); }
// Token: 0x0600049E RID: 1182 RVA: 0x000108B0 File Offset: 0x0000EAB0 protected override void InternalBeginProcessing() { base.InternalBeginProcessing(); if (!string.IsNullOrEmpty(this.ExternalDirectoryObjectId)) { ITenantRecipientSession tenantRecipientSession = base.TenantGlobalCatalogSession as ITenantRecipientSession; if (tenantRecipientSession != null) { bool useGlobalCatalog = tenantRecipientSession.UseGlobalCatalog; tenantRecipientSession.UseGlobalCatalog = false; Result <ADRawEntry>[] array = null; try { array = tenantRecipientSession.FindByExternalDirectoryObjectIds(new string[] { this.ExternalDirectoryObjectId }, true, new ADPropertyDefinition[] { DeletedObjectSchema.LastKnownParent }); } finally { tenantRecipientSession.UseGlobalCatalog = useGlobalCatalog; } if (array != null) { for (int i = 0; i < array.Length; i++) { if (array[i].Error != ProviderError.NotFound || array[i].Data != null) { ADObjectId adobjectId = null; if (array[i].Error == null) { adobjectId = (ADObjectId)array[i].Data[DeletedObjectSchema.LastKnownParent]; } if (array[i].Error != null || adobjectId == null || (adobjectId.DomainId != null && !adobjectId.IsDescendantOf(ADSession.GetDeletedObjectsContainer(adobjectId.DomainId)))) { base.ThrowTerminatingError(new DuplicateExternalDirectoryObjectIdException(this.Name, this.ExternalDirectoryObjectId), ExchangeErrorCategory.Client, null); } } } } } } bool useConfigNC = this.ConfigurationSession.UseConfigNC; bool useGlobalCatalog2 = this.ConfigurationSession.UseGlobalCatalog; this.ConfigurationSession.UseConfigNC = false; this.ConfigurationSession.UseGlobalCatalog = true; IConfigurationSession cfgSession = this.ConfigurationSession; if (!cfgSession.IsReadConnectionAvailable()) { cfgSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, this.ConfigurationSession.SessionSettings, 623, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\NewAdObjectTask.cs"); cfgSession.UseGlobalCatalog = true; cfgSession.UseConfigNC = false; } try { ExchangeOrganizationalUnit exchangeOrganizationalUnit = null; if (this.OrganizationalUnit != null) { exchangeOrganizationalUnit = base.ProvisioningCache.TryAddAndGetGlobalDictionaryValue <ExchangeOrganizationalUnit, string>(CannedProvisioningCacheKeys.OrganizationalUnitDictionary, this.OrganizationalUnit.RawIdentity, () => (ExchangeOrganizationalUnit)this.GetDataObject <ExchangeOrganizationalUnit>(this.OrganizationalUnit, cfgSession, (this.CurrentOrganizationId != null) ? this.CurrentOrganizationId.OrganizationalUnit : null, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.OrganizationalUnit.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.OrganizationalUnit.ToString())))); } if (exchangeOrganizationalUnit != null) { this.containerId = exchangeOrganizationalUnit.Id; } else if (base.CurrentOrganizationId != null && base.CurrentOrganizationId.OrganizationalUnit != null) { this.containerId = base.CurrentOrganizationId.OrganizationalUnit; } else { string defaultOUForRecipient = RecipientTaskHelper.GetDefaultOUForRecipient(base.ServerSettings.RecipientViewRoot); if (string.IsNullOrEmpty(defaultOUForRecipient)) { base.ThrowTerminatingError(new TaskArgumentException(Strings.ErrorCannotDiscoverDefaultOrganizationUnitForRecipient), ExchangeErrorCategory.Client, null); } exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(new OrganizationalUnitIdParameter(defaultOUForRecipient), cfgSession, null, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(defaultOUForRecipient)), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(defaultOUForRecipient)), ExchangeErrorCategory.Client); this.containerId = exchangeOrganizationalUnit.Id; } if (exchangeOrganizationalUnit != null) { RecipientTaskHelper.IsOrgnizationalUnitInOrganization(cfgSession, base.CurrentOrganizationId, exchangeOrganizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError)); } } finally { this.ConfigurationSession.UseConfigNC = useConfigNC; this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog2; } }