Share via


Custom attributes in Exchange Server

Exchange Server includes 15 extension attributes that you can use to add information about a recipient, such as an employee ID, organizational unit (OU), or some other custom value for which there isn't an existing attribute.

In earlier versions of Exchange, if you wanted to store this information in Active Directory, you had to create an attribute by extending the Active Directory schema. Schema extension requires planning, procuring object identifiers (OIDs) for new attributes, and testing the extension process in a test environment before you implement it in a production environment. Exchange Server doesn't let you use schema extensions in recipient filters that are used by address lists, e-mail address policies, and dynamic distribution groups.

The custom attributes available to Exchange Server are labeled in Active Directory as ms-Exch-Extension-Attribute1 through ms-Exch-Extension-Attribute15. In the Exchange Management Shell, the corresponding parameters are CustomAttribute1 through CustomAttribute15. These attributes aren't used by any Exchange components. They can be used to store Active Directory data without having to extend the Active Directory schema.

Note

ms-Exch-Extension-Attribute-16 to ms-Exch-Extension-Attribute-45 are present in Active Directory, but aren't available in the Exchange admin center (EAC) or the Exchange Management Shell. Don't use non-Exchange tools to edit these attributes because they might be used for future Exchange features.

Advantages of custom attributes

There are several advantages to using custom attributes:

  • You avoid extending the Active Directory schema.

  • You don't have to do the work, because the attributes are created by Exchange Setup.

  • You can use the EAC or the Exchange Management Shell to manage the attributes. You don't need to build custom controls or write scripts to populate and display these attributes.

  • You can filter and reuse the attributes, as attributes are filterable properties that can be used in the Filter parameter with recipient cmdlets such as Get-Mailbox. They can also be used in the EAC and the Exchange Management Shell to create filters for e-mail address policies, address lists, and dynamic distribution groups.

Multivalued custom attributes

Starting with Exchange 2010 Service Pack 2 (SP2), five multivalued custom attributes were added to Exchange to allow you to store additional information for mail recipients if the traditional custom attributes didn't meet your needs. The ExtensionCustomAttribute1 to ExtensionCustomAttribute5 parameters can hold up to 1,300 values each. You can specify multiple values as a comma-delimited list. The following cmdlets support these new parameters:

For more information about multivalued properties, see Modifying multivalued properties.

Custom attribute examples

A common scenario in many Exchange deployments is that of creating an e-mail address policy for all recipients in an OU. The OU isn't a filterable property that can be used in the RecipientFilter parameter of an e-mail address policy or an address list.

Note

Dynamic distribution groups have an additional parameter that you can use to restrict it to recipients in a particular OU or container.

If the recipients in a particular OU don't share any common properties that you can filter by, such as department or location, you can populate one of the custom attributes with a common value, as shown in this example.

Get-Mailbox -OrganizationalUnit Sales | Set-Mailbox -CustomAttribute1 "SalesOU"

With that done, now you can create an e-mail address policy for all recipients that have the CustomAttribute1 property that equals SalesOU, as shown in this example.

New-EmailAddressPolicy -Name "Sales" -RecipientFilter "CustomAttribute1 -eq 'SalesOU'" -EnabledEmailAddressTemplates "SMTP:%s%[email protected]"

Custom attribute example using the ConditionalCustomAttributes parameter

When creating dynamic distribution groups, email address policies, or address lists, you don't need to use the RecipeintFilter parameter to specify custom attributes. You can use the ConditionalCustomAttribute1 to ConditionalCustomAttribute15 parameters instead.

This example creates a dynamic distribution group based on the recipients whose CustomAttribute1 is set to SalesOU.

New-DynamicDistributionGroup -Name "Sales Users and Contacts" -IncludedRecipients "MailboxUsers,MailContacts" -ConditionalCustomAttribute1 "SalesOU"

Note

You need to use the IncludedRecipients parameter if you use a Conditional parameter. In addition, you can't use Conditional parameters if you use the RecipientFilter parameter. If you want to include additional filters to create your dynamic distribution group, email address policies, or address lists, you should use the RecipientFilter parameter.

Custom attribute example using ExtensionCustomAttributes parameter

In this example, the mailbox for Kweku will have ExtensionCustomAttribute1 updated to reflect that he's enrolled in the following educational classes: MATH307, ECON202, and ENGL300.

Set-Mailbox -Identity Kweku -ExtensionCustomAttribute1 MATH307,ECON202,ENGL300

Next, a dynamic distribution group for all students enrolled MATH307 is created by using the RecipientFilter parameter where ExtensionCustomAttribute1 is equal to MATH307. When using the ExtentionCustomAttributes parameters, you can use the -eq operator instead of the -like operator.

New-DynamicDistributionGroup -Name Students_MATH307 -RecipientFilter "ExtensionCustomAttribute1 -eq 'MATH307'"

In this example, Kweku's ExtensionCustomAttribute1 values are updated to reflect that he's added the class ENGL210 and removed the class ECON202.

Set-Mailbox -Identity Kweku -ExtensionCustomAttribute1 @{Add="ENGL210"; Remove="ECON202"}