Search code examples
powershellactive-directoryoffice365exchange-server

Adding contact to multiple address lists with recipientfilter


Is there a proper way to add users to multiple address lists, using only a single extensionAttribute on the users?

I'm currently creating some address lists for our employees to use.

Let's say i have an addresslist called "CompanyA" and "CompanyB" I then have a single user that needs to be shown in both "CompanyA" and "CompanyB".

I have currently created a recipient filter for each addresslist that says

CompanyA:

-RecipientFilter "(CustomAttribute14 -like 'CompanyA')"

CompanyB:

-RecipientFilter "(CustomAttribute14 -like 'CompanyB')"

I have then on the user in AD, found extentionAttribute14 and added the values CompanyA; CompanyB In the hopes that the delimiter ; would make it read both values for each list.

I have found this to not work and i think i need to redo the filters on the address lists, but i can't find any sort of hints of where to start or how to approach these filters.

I can of course do

-RecipientFilter "(CustomAttribute14 -like 'CompanyB') or (CustomAttribute14 -like 'CompanyA')"

However that would take all the users with either values into this list.


Solution

  • As Mathias wrote, i was missing the wildcard tags before and after the name i wanted to filter for.

    Filter would have to be -like '*CompanyA*' since the attribute now contains more than just the single string – Mathias R. Jessen