internal IEnumerable <T> GetADObjectIdObjects <T>(ADObjectId identity, ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData) where T : IConfigurable, new() { if (identity != null) { OrganizationId organizationId; if (this.InternalADObjectId != null && this.InternalADObjectId.Equals(identity) && this.orgIdResolved) { organizationId = this.resolvedOrganizationId; } else { organizationId = this.GetOrganizationId(session.SessionSettings.CurrentOrganizationId, identity); } IDirectorySession directorySession = session; if (organizationId != null) { directorySession = TaskHelper.UnderscopeSessionToOrganization(session, organizationId, true); } if (session.ConfigScope == ConfigScopes.TenantSubTree) { directorySession = ADSession.RescopeSessionToTenantSubTree(directorySession); } if (directorySession.IsRootIdWithinScope <T>(rootId)) { if (ADObjectId.Equals(identity, identity.DomainId) && !typeof(OrganizationalUnitIdParameterBase).IsAssignableFrom(base.GetType())) { if (!typeof(ADRawEntryIdParameter).IsAssignableFrom(base.GetType())) { goto IL_15F; } } try { ADObjectId rootId2 = rootId; bool enforceContainerizedScoping = directorySession.EnforceContainerizedScoping; bool flag = directorySession is IRecipientSession; if (rootId == null && !string.IsNullOrEmpty(identity.DistinguishedName)) { if (!ADObjectId.Equals(identity, identity.DomainId) && directorySession.IsRootIdWithinScope <T>(identity.Parent)) { rootId2 = identity.Parent; } else if (directorySession.IsRootIdWithinScope <T>(identity)) { rootId2 = identity; if (flag) { directorySession.EnforceContainerizedScoping = false; } } } try { EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(this.PerformPrimarySearch <T>(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, identity), rootId2, directorySession, true, optionalData)); if (wrapper.HasElements()) { return(wrapper); } } finally { if (flag) { directorySession.EnforceContainerizedScoping = enforceContainerizedScoping; } } } catch (LocalizedException exception) { if (!TaskHelper.IsTaskKnownException(exception)) { throw; } } IL_15F: if (identity.ObjectGuid != Guid.Empty) { return(this.PerformPrimarySearch <T>(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, identity.ObjectGuid), rootId, directorySession, true, optionalData)); } } } return(EnumerableWrapper <T> .Empty); }