What do you need to know before you begin?

  • Estimated time to complete each procedure: 5 minutes.
  • You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the ”Address lists” entry in the Email Address and Address Book Permissions topic.
  • By default in Exchange Online, the Address List role isn’t assigned to any role groups. To use any cmdlets that require the Address List role, you need to add the role to a role group. For details, see the “Add a role to a role assignment policy” section of Manage Role Assignment Policies.
  • To use the RecipientFilter parameter to create a custom filter, you must specify a string for the filter. The Shell uses OPATH for the filtering syntax. OPATH is a querying language designed to query object data sources.
  • You can’t use the Exchange Administration Center (EAC) to perform this procedure. You must use the Shell.
  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard Shortcuts in the Exchange Admin Center.
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection

Use the Shell to create an address list by using recipient filters

This example creates an address list for all users with Exchange mailboxes who reside in Washington or Oregon.

New-AddressList -Name "Pacific Northwest Mailboxes" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and ((StateOrProvince -eq 'Washington') -or (StateOrProvince -eq 'Oregon')))}

This example creates an address list for all users with Exchange mailboxes who have AgencyB as the value for the CustomAttribute15 parameter.

New-AddressList -Name "AgencyB" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (CustomAttribute15 -like *AgencyB*)}

For detailed syntax and parameter information, see New-AddressList.