private void SetMembers(IRecipientSession adRecipientSession, IADDistributionList distributionList, GetGroupResponse response) { ADGroup adgroup = distributionList as ADGroup; if (adgroup == null) { throw new InvalidOperationException("AD DL object that is not dynamic DL must be ADGroup class"); } if (adgroup.HiddenGroupMembershipEnabled) { this.WriteDebugTrace("HiddenGroupMembershipEnabled is true - Members information is not loaded"); return; } if (this.paging.Offset < 0 || distributionList.Members.Count <= this.paging.Offset) { this.WriteDebugTrace(string.Format("Provided offset is out of range - members count is {0}, offset is {1}.", distributionList.Members.Count, this.paging.Offset)); return; } QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, adgroup.Id); SortBy sortBy = new SortBy(ADRecipientSchema.DisplayName, SortOrder.Ascending); ADPagedReader <ADRawEntry> adpagedReader = adRecipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, filter, sortBy, 10000, GetGroupCommand.groupItemsProperties); using (IEnumerator <ADRawEntry> enumerator = adpagedReader.GetEnumerator()) { List <Persona> list = new List <Persona>(); int num = 0; int num2 = this.paging.Offset + this.paging.MaxRows; while (enumerator.MoveNext()) { if (num < this.paging.Offset) { num++; } else { if (num == num2) { break; } Persona personaFromADObject = GetGroupCommand.GetPersonaFromADObject(enumerator.Current); if (personaFromADObject != null) { list.Add(personaFromADObject); num++; } else { response.MembersCount--; } } } response.Members = list.ToArray(); this.WriteDebugTrace("DL members count loaded in the response is " + response.Members.Length); } }
private IEnumerable <ComplianceMessage> ResolveTargets(IEnumerable <ComplianceMessage> sources) { byte[] lastTenantId = null; using (IEnumerator <ComplianceMessage> enumerator = sources.GetEnumerator()) { while (enumerator.MoveNext()) { ComplianceMessage source = enumerator.Current; if (source.MessageTarget.TargetType == Target.Type.Driver) { source.MessageTarget.Database = Guid.Empty; source.MessageTarget.Mailbox = Guid.Empty; yield return(source); } else if (!ExceptionHandler.IsFaulted(source) && (source.MessageTarget.Database == Guid.Empty || source.MessageTarget.Mailbox == Guid.Empty)) { bool resolved = false; IRecipientSession recipientSession = null; if (lastTenantId == source.TenantId) { goto IL_22C; } FaultDefinition faultDefinition; if (ExceptionHandler.DataSource.TryRun(delegate { recipientSession = this.GetSession(source.TenantId); }, ActiveDirectoryTargetResolver.DataLookupTime, out faultDefinition, source, null, default(CancellationToken), null, "ResolveTargets", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionCommon\\Resolver\\ActiveDirectoryTargetResolver.cs", 170)) { goto IL_22C; } ExceptionHandler.FaultMessage(source, faultDefinition, true); IL_51C: if (!resolved && ExceptionHandler.IsFaulted(source)) { yield return(source); continue; } continue; IL_22C: if (recipientSession != null) { ActiveDirectoryTargetResolver.< > c__DisplayClass15 CS$ < > 8__locals3 = new ActiveDirectoryTargetResolver.< > c__DisplayClass15(); CS$ < > 8__locals3.filter = this.GetFilter(source.MessageTarget); if (CS$ < > 8__locals3.filter == null) { ExceptionHandler.FaultMessage(source, FaultDefinition.FromErrorString("Could not build query filter for target", "ResolveTargets", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionCommon\\Resolver\\ActiveDirectoryTargetResolver.cs", 226), true); goto IL_51C; } ADPagedReader <ADRawEntry> reader = null; if (!ExceptionHandler.DataSource.TryRun(delegate { reader = recipientSession.FindPagedADRawEntry(null, QueryScope.OneLevel, CS$ < > 8__locals3.filter, null, 100, ActiveDirectoryTargetResolver.properties); }, ActiveDirectoryTargetResolver.DataLookupTime, out faultDefinition, source, null, default(CancellationToken), null, "ResolveTargets", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionCommon\\Resolver\\ActiveDirectoryTargetResolver.cs", 191))
internal static object[][] GetDirectReportsView(IRecipientSession adSession, IADOrgPerson person, params PropertyDefinition[] returnProperties) { if (returnProperties == null) { throw new ArgumentNullException("returnProperties"); } QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADOrgPersonSchema.Manager, person.Id); ADPagedReader <ADRawEntry> adpagedReader = adSession.FindPagedADRawEntry(adSession.SearchRoot, QueryScope.SubTree, filter, null, 0, returnProperties); ADRawEntry[] recipients = adpagedReader.ReadAllPages(); return(ADSession.ConvertToView(recipients, returnProperties)); }
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); }
public static ADPagedReader <ADRawEntry> GetAllGroupMembers(IRecipientSession recipientSession, ADObjectId groupId, IEnumerable <PropertyDefinition> properties, SortBy sortBy, QueryFilter searchFilter = null, int pageSize = 0) { QueryFilter queryFilter = QueryFilter.AndTogether(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, IUnifiedGroupMailboxSchema.UnifiedGroupMembersBL, groupId), new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.ObjectClass, ADUser.MostDerivedClass) }); if (searchFilter != null) { queryFilter = QueryFilter.AndTogether(new QueryFilter[] { queryFilter, searchFilter }); } return(recipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, queryFilter, sortBy, pageSize, properties)); }
// Token: 0x060008FA RID: 2298 RVA: 0x0003CBC0 File Offset: 0x0003ADC0 internal void UpdateAllUserSettings(IRecipientSession recipientSession, long cookie, Initiating.ActOnUserSettingsDelegate updateUserSettings, Predicate <ADRawEntry> validate) { QueryFilter filter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.Database, new ADObjectId(base.Context.Guid)), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox) }); ADPagedReader <ADRawEntry> adpagedReader = recipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, filter, null, 0, new PropertyDefinition[] { ADObjectSchema.Id, ADRecipientSchema.TextMessagingState, IADMailStorageSchema.ExchangeGuid }); using (IEnumerator <ADRawEntry> enumerator = adpagedReader.GetEnumerator()) { while (enumerator.MoveNext()) { ADRawEntry recipient = enumerator.Current; if (!base.ShouldContinue(cookie)) { break; } if (validate == null || validate(recipient)) { if (this.mailboxTable == null) { this.mailboxTable = base.Context.GetMailboxTable(ClientType.EventBased, new PropertyTagPropertyDefinition[0]); } if (!this.mailboxTable.Exists((MailboxInformation mbxInfo) => mbxInfo.MailboxGuid == (Guid)recipient[IADMailStorageSchema.ExchangeGuid])) { ADUser aduser = recipientSession.FindADUserByObjectId((ADObjectId)recipient[ADObjectSchema.Id]); if (aduser != null) { ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(aduser, null); MailboxSession mailboxSession = null; try { mailboxSession = base.Context.GetMailbox(exchangePrincipal, ClientType.EventBased, "UpdateAllUserSettings"); if (!base.ShouldContinue(cookie)) { break; } updateUserSettings(mailboxSession, recipientSession, aduser); } catch (NotSupportedException arg) { ExTraceGlobals.AssistantTracer.TraceError <string, NotSupportedException>((long)this.GetHashCode(), "Exception is caught during syncing text messaging settings to AD user object for {0}: {1}", exchangePrincipal.LegacyDn, arg); } catch (Exception ex) { if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "Update all user's settings", exchangePrincipal.LegacyDn, ex)) { throw; } } finally { if (mailboxSession != null) { mailboxSession.Dispose(); mailboxSession = null; } } } } } } } }