Address List Filter.

Copper Contributor

Hello World,

 

In a total road block here. Here the break down of what I got:

 

Sync Mail Contacts from AD to Azure AD - No problem.

 

Run the following commands to filter this contacts into a new Address List for Exchange Online:

 

Set-AddressList -Identity “\Im not Tell you" -IncludedRecipients MailContacts -ConditionalCompany {(('Im not Tell you.com') -and ('Im not Tell you.net') -and ('Im not Tell you.org'))}

 

Set-AddressList -Identity “\Im not Tell you" -IncludedRecipients MailContacts -ConditionalCompany "Im not Tell you.com","Im not Tell you.net","Im not Tell you.org"

 

No matter how I twist PowerShell arm, the filter doesn't apply. First command kinda worked, but just filtered one contact out of hundreds.

 

Place tell me someone got a better way of filtering Mail Contacts base on Company Name?

2 Replies

First of all, there are limited sets of attributes you can use for address lists in O365, and in general I'd suggest you use the RecipientFilter parameter. In any case, once you have created the address list, you need to "touch" the objects in order for them to appear in it. Meaning, you need to update any of their properties for them to appear in the newly created AL. Read here: http://support.microsoft.com/kb/2955640

Thank you for the response, but unfortunately this doesn't help.

The problem with the Recipient Filter is that OPath doesn't like Company Attribute, which is why CustomCompanyAttributes (I suppose). In any event, using CustomAttribute didn't really yield any great results neither.

Meaning, taking the company name and placing into custom attribute 1 thru 15. Here the results of Get-AddressList, naturally some stuff is removed for personal reasons.

RunspaceId : 384d5f1c-3e49-467e-9246-3671c19c3161
Container : \Address Lists Container\All Address Lists
Path : \Address Lists Container\All Address Lists\PSI Contacts
DisplayName : PSI Contacts
Name : PSI Contacts
RecipientFilter : ((((Company -eq 'TaTa.com') -or (Company -eq 'BlaBla.com') -or (Company
-eq 'LaLa.com') -or (Company -eq 'AhAh'))) -and (RecipientType -eq 'MailContact'))
LdapRecipientFilter : (&(|(company=TaTa.com)(company=BlaBla.com)(company=LaLa.com)(company=AhAh)
)(objectClass=contact)(mailNickname=*))
LastUpdatedRecipientFilter :
RecipientFilterApplied : False
IncludedRecipients : MailContacts
ConditionalDepartment : {}
ConditionalCompany : {TaTa, LaLa.com, BlaBla.com, AhAh.com}
ConditionalStateOrProvince : {}
ConditionalCustomAttribute1 : {}
ConditionalCustomAttribute2 : {}
ConditionalCustomAttribute3 : {}
ConditionalCustomAttribute4 : {}
ConditionalCustomAttribute5 : {}
ConditionalCustomAttribute6 : {}
ConditionalCustomAttribute7 : {}
ConditionalCustomAttribute8 : {}
ConditionalCustomAttribute9 : {}
ConditionalCustomAttribute10 : {}
ConditionalCustomAttribute11 : {}
ConditionalCustomAttribute12 : {}
ConditionalCustomAttribute13 : {}
ConditionalCustomAttribute14 : {}
ConditionalCustomAttribute15 : {}
RecipientContainer :
RecipientFilterType : Precanned
Identity : \PSI Contacts
Id : \PSI Contacts
IsValid : True

In the recipients filter, the OR operator is automatically place when you use CustomCompany Parameter. But I've also gotten the AND operator too, but the results are the same.