public static string ToSourceMailboxFilterString(this object anr) { QueryFilter queryFilter = StringExtension.ToRecipientTypeDetailsFilter(new RecipientTypeDetails[] { RecipientTypeDetails.UserMailbox, RecipientTypeDetails.LinkedMailbox, RecipientTypeDetails.TeamMailbox, RecipientTypeDetails.SharedMailbox, RecipientTypeDetails.LegacyMailbox, RecipientTypeDetails.RoomMailbox, RecipientTypeDetails.EquipmentMailbox, (RecipientTypeDetails)((ulong)int.MinValue), RecipientTypeDetails.RemoteRoomMailbox, RecipientTypeDetails.RemoteEquipmentMailbox, RecipientTypeDetails.RemoteTeamMailbox, RecipientTypeDetails.RemoteSharedMailbox }, new RecipientTypeDetails[] { RecipientTypeDetails.MailUniversalDistributionGroup, RecipientTypeDetails.MailUniversalSecurityGroup, RecipientTypeDetails.MailNonUniversalGroup, RecipientTypeDetails.DynamicDistributionGroup }, ExchangeObjectVersion.Exchange2010); string text = (anr == DBNull.Value) ? string.Empty : ((string)anr); if (text.Length > 0) { queryFilter = new AndFilter(new QueryFilter[] { StringExtension.ANRToQueryFilter(text), queryFilter }); } return(LdapFilterBuilder.LdapFilterFromQueryFilter(queryFilter)); }
protected void ValidateBrokenRecipientFilterChange(QueryFilter expectedRecipientFilter) { if (!this.DataObject.IsModified(AddressBookBaseSchema.RecipientFilter) || this.originalVersion.IsOlderThan(AddressBookBaseSchema.RecipientFilter.VersionAdded)) { if (this.DataObject.IsChanged(AddressBookBaseSchema.LdapRecipientFilter)) { string b = (expectedRecipientFilter == null) ? string.Empty : LdapFilterBuilder.LdapFilterFromQueryFilter(expectedRecipientFilter); if (!string.Equals(this.DataObject.LdapRecipientFilter, b, StringComparison.OrdinalIgnoreCase)) { string expected = (expectedRecipientFilter == null) ? string.Empty : expectedRecipientFilter.GenerateInfixString(FilterLanguage.Monad); if (this.DataObject.IsTopContainer) { TIdParameter identity = this.Identity; base.WriteError(new InvalidOperationException(Strings.ErrorInvalidFilterForAddressBook(identity.ToString(), this.DataObject.RecipientFilter, expected)), ErrorCategory.InvalidOperation, this.DataObject.Identity); return; } TIdParameter identity2 = this.Identity; base.WriteError(new InvalidOperationException(Strings.ErrorInvalidFilterForDefaultGlobalAddressList(identity2.ToString(), this.DataObject.RecipientFilter, GlobalAddressList.RecipientFilterForDefaultGal.GenerateInfixString(FilterLanguage.Monad))), ErrorCategory.InvalidOperation, this.DataObject.Identity); } } return; } if (this.DataObject.IsTopContainer) { TIdParameter identity3 = this.Identity; base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnContainer(identity3.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); return; } TIdParameter identity4 = this.Identity; base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnDefaultGAL(identity4.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); }
// Token: 0x06001955 RID: 6485 RVA: 0x0006BA74 File Offset: 0x00069C74 internal void SetRecipientFilter(QueryFilter filter) { if (filter == null) { this[ADDynamicGroupSchema.RecipientFilter] = string.Empty; this[ADDynamicGroupSchema.LdapRecipientFilter] = string.Empty; } else { QueryFilter queryFilter = new AndFilter(new QueryFilter[] { filter, RecipientFilterHelper.ExcludingSystemMailboxFilter, RecipientFilterHelper.ExcludingCasMailboxFilter, RecipientFilterHelper.ExcludingMailboxPlanFilter, RecipientFilterHelper.ExcludingDiscoveryMailboxFilter, RecipientFilterHelper.ExcludingPublicFolderMailboxFilter, RecipientFilterHelper.ExcludingArbitrationMailboxFilter, RecipientFilterHelper.ExcludingAuditLogMailboxFilter }); this[ADDynamicGroupSchema.RecipientFilter] = queryFilter.GenerateInfixString(FilterLanguage.Monad); this[ADDynamicGroupSchema.LdapRecipientFilter] = LdapFilterBuilder.LdapFilterFromQueryFilter(queryFilter); } RecipientFilterHelper.SetRecipientFilterType(WellKnownRecipientFilterType.Custom, this.propertyBag, ADDynamicGroupSchema.RecipientFilterMetadata); }
private void CreateCannedSystemAddressLists(IConfigurationSession session, AddressBookBase parent, out Dictionary <string, bool> addressListsCreated) { addressListsCreated = new Dictionary <string, bool>(); foreach (string text in CannedSystemAddressLists.RecipientFilters.Keys) { AddressBookBase addressBookBase = session.Read <AddressBookBase>(parent.Id.GetChildId(text)); bool flag = false; bool flag2 = false; if (addressBookBase == null) { flag = true; addressBookBase = new AddressBookBase(); addressBookBase.SetId(parent.Id.GetChildId(text)); addressBookBase.DisplayName = text; addressBookBase.OrganizationId = parent.OrganizationId; addressBookBase.IsSystemAddressList = CannedSystemAddressLists.SystemFlags[text]; } if (flag || !string.Equals(LdapFilterBuilder.LdapFilterFromQueryFilter(CannedSystemAddressLists.RecipientFilters[text]), addressBookBase.LdapRecipientFilter, StringComparison.OrdinalIgnoreCase)) { flag2 = true; addressBookBase.SetRecipientFilter(CannedSystemAddressLists.RecipientFilters[text]); addressBookBase[AddressBookBaseSchema.RecipientFilterFlags] = RecipientFilterableObjectFlags.FilterApplied; base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(addressBookBase, session, typeof(AddressBookBase))); try { session.Save(addressBookBase); } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(session)); } } addressListsCreated.Add(text, flag || flag2); } }
public void BuildFilter(out string parameterList, out string filter, out string preArgs, DataRow row) { QueryFilter queryFilter = (QueryFilter)row["RecipientPreviewFilter"]; filter = null; preArgs = null; parameterList = "-RecipientPreviewFilter '" + LdapFilterBuilder.LdapFilterFromQueryFilter(queryFilter).ToQuotationEscapedString() + "'"; }
internal static QueryFilter GetFindFilterForCannedAddressLists(string name, QueryFilter recipientFilter) { string propertyValue = LdapFilterBuilder.LdapFilterFromQueryFilter(recipientFilter); return(new OrFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, AddressBookBaseSchema.LdapRecipientFilter, propertyValue), CannedAddressListsFilterHelper.GetFindFilterForOlderAddressList(name) })); }
private IEnumerable <ADRawEntry> FindObjects(ADObjectId[] identities, IEnumerable <PropertyDefinition> propertiesToRead) { if (ADSessionSettings.GetThreadServerSettings() == null) { EcpRunspaceFactory ecpRunspaceFactory = new EcpRunspaceFactory(new InitialSessionStateSectionFactory()); ADSessionSettings.SetThreadADContext(new ADDriverContext(ecpRunspaceFactory.CreateRunspaceServerSettings(), ContextMode.Cmdlet)); } IDirectorySession session = this.CreateAdSession(); List <QueryFilter> filters = new List <QueryFilter>(this.properMaxCustomFilterTreeSize); int filterLenRemain = 31197; int i = 0; while (i < identities.Length) { QueryFilter idFilter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, identities[i]); filters.Add(idFilter); string ldapIdFilter = LdapFilterBuilder.LdapFilterFromQueryFilter(idFilter); if (ldapIdFilter.Length > filterLenRemain || filters.Count == this.properMaxCustomFilterTreeSize || i == identities.Length - 1) { ADPagedReader <ADRawEntry> entries = null; try { entries = session.FindPagedADRawEntry(null, QueryScope.SubTree, new OrFilter(filters.ToArray()), null, this.properMaxCustomFilterTreeSize, propertiesToRead); } catch (ADFilterException) { if (this.isFirstError) { i -= filters.Count; this.properMaxCustomFilterTreeSize /= 2; filters.Clear(); filterLenRemain = 31197; this.isFirstError = false; goto IL_22E; } throw; } foreach (ADRawEntry entry in entries) { yield return(entry); } filters.Clear(); filterLenRemain = 31197; goto IL_216; } goto IL_216; IL_22E: i++; continue; IL_216: filterLenRemain -= ldapIdFilter.Length; goto IL_22E; } yield break; }
internal void SetRecipientFilter(QueryFilter filter) { if (filter == null) { this[EmailAddressPolicySchema.RecipientFilter] = string.Empty; this[EmailAddressPolicySchema.LdapRecipientFilter] = string.Empty; } else { this[EmailAddressPolicySchema.RecipientFilter] = filter.GenerateInfixString(FilterLanguage.Monad); this[EmailAddressPolicySchema.LdapRecipientFilter] = LdapFilterBuilder.LdapFilterFromQueryFilter(filter); } RecipientFilterHelper.SetRecipientFilterType(WellKnownRecipientFilterType.Custom, this.propertyBag, EmailAddressPolicySchema.RecipientFilterMetadata); }
protected override void UpdateFilterProperty() { base.UpdateFilterProperty(); if (this.MinVersion != null) { QueryFilter queryFilter = new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ADObjectSchema.ExchangeVersion, this.MinVersion); if (!this.RecipientTypeDetailsWithoutVersionRestriction.IsNullOrEmpty()) { QueryFilter recipientTypeDetailsFilter = RecipientIdParameter.GetRecipientTypeDetailsFilter(base.RecipientTypeDetailsList); if (recipientTypeDetailsFilter != null) { queryFilter = new AndFilter(new QueryFilter[] { recipientTypeDetailsFilter, queryFilter }); } recipientTypeDetailsFilter = RecipientIdParameter.GetRecipientTypeDetailsFilter(this.RecipientTypeDetailsWithoutVersionRestriction); queryFilter = new OrFilter(new QueryFilter[] { recipientTypeDetailsFilter, queryFilter }); base.RecipientTypeDetailsList = null; } string text = (string)base["Filter"]; if (!text.IsNullOrBlank()) { base["Filter"] = string.Empty; MonadFilter monadFilter = new MonadFilter(text, null, ObjectSchema.GetInstance <ReducedRecipientSchema>()); queryFilter = new AndFilter(new QueryFilter[] { monadFilter.InnerFilter, queryFilter }); } base["RecipientPreviewFilter"] = LdapFilterBuilder.LdapFilterFromQueryFilter(queryFilter); } }
// Token: 0x06001D40 RID: 7488 RVA: 0x00079A68 File Offset: 0x00077C68 private static void PersistPrecannedRecipientFilter(IPropertyBag propertyBag, ADPropertyDefinition filterMeatadata, ADPropertyDefinition filter, ADPropertyDefinition ldapFilter, bool isDynamicGroup) { List <QueryFilter> list = new List <QueryFilter>(); switch (RecipientFilterHelper.GetPrecannedRecipientFilter(propertyBag, filterMeatadata, filter, ldapFilter, false, list)) { case -1: break; case 0: propertyBag[filter] = string.Empty; propertyBag[ldapFilter] = string.Empty; return; default: if (list.Count > 0) { QueryFilter queryFilter = (list.Count > 1) ? new AndFilter(list.ToArray()) : list[0]; if (isDynamicGroup) { queryFilter = new AndFilter(new QueryFilter[] { queryFilter, RecipientFilterHelper.ExcludingSystemMailboxFilter, RecipientFilterHelper.ExcludingCasMailboxFilter, RecipientFilterHelper.ExcludingMailboxPlanFilter, RecipientFilterHelper.ExcludingDiscoveryMailboxFilter, RecipientFilterHelper.ExcludingPublicFolderMailboxFilter, RecipientFilterHelper.ExcludingArbitrationMailboxFilter, RecipientFilterHelper.ExcludingAuditLogMailboxFilter }); } propertyBag[filter] = queryFilter.GenerateInfixString(FilterLanguage.Monad); propertyBag[ldapFilter] = LdapFilterBuilder.LdapFilterFromQueryFilter(queryFilter); } break; } }
protected override void StampChangesOn(IConfigurable dataObject) { EmailAddressPolicy emailAddressPolicy = (EmailAddressPolicy)dataObject; bool flag = EmailAddressPolicyPriority.Lowest == emailAddressPolicy.Priority; if (flag) { if (this.Instance.IsChanged(ADObjectSchema.RawName) || ((EmailAddressPolicy)this.GetDynamicParameters()).IsChanged(ADObjectSchema.Name) || this.Instance.IsChanged(EmailAddressPolicySchema.Priority) || this.Instance.IsChanged(EmailAddressPolicySchema.RecipientContainer) || ((EmailAddressPolicy)this.GetDynamicParameters()).IsChanged(EmailAddressPolicySchema.RecipientContainer) || base.Fields.IsModified("RecipientContainer")) { base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnLowestEap(dataObject.Identity.ToString())), ErrorCategory.InvalidOperation, dataObject.Identity); } if (!emailAddressPolicy.ExchangeVersion.IsOlderThan(EmailAddressPolicySchema.RecipientFilter.VersionAdded) && (base.Fields.IsModified(EmailAddressPolicySchema.RecipientFilter) || RecipientFilterHelper.IsRecipientFilterPropertiesModified((ADObject)this.GetDynamicParameters(), false) || RecipientFilterHelper.IsRecipientFilterPropertiesModified(this.Instance, true))) { base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnLowestEap(dataObject.Identity.ToString())), ErrorCategory.InvalidOperation, dataObject.Identity); } } base.StampChangesOn(dataObject); if (base.Fields.IsModified(EmailAddressPolicySchema.RecipientFilter)) { emailAddressPolicy.SetRecipientFilter(this.innerFilter); } if (flag && emailAddressPolicy.IsChanged(EmailAddressPolicySchema.LdapRecipientFilter) && !string.Equals(emailAddressPolicy.LdapRecipientFilter, LdapFilterBuilder.LdapFilterFromQueryFilter(EmailAddressPolicy.RecipientFilterForDefaultPolicy), StringComparison.OrdinalIgnoreCase)) { base.WriteError(new InvalidOperationException(Strings.ErrorInvalidFilterForLowestEap(this.Identity.ToString(), emailAddressPolicy.RecipientFilter)), ErrorCategory.InvalidOperation, dataObject.Identity); } }