A multivalued property is a property that can contain more than one value. For example, the BlockedRecipients property on the RecipientFilterConfig object can accept multiple recipient addresses as in the following examples:

john@contoso.com

kim@northwindtraders.com

david@adatum.com

Because the BlockedRecipients property can accept more than one value, it's called a multivalued property.

How you modify a multivalued property is slightly different from how you modify a property that accepts only one value. When you modify a property that accepts only a single value, you can assign a value directly to it, as in the following command:

When you use this command to provide a new value to the MaxSendSize property, the stored value is overwritten. This isn't a problem with properties that accept only one value. However, it becomes a problem with multivalued properties. For example, assume that the BlockedRecipients property on the RecipientFilterConfig property is configured to have the three values that are listed in the previous section. When you run the command Get-RecipientFilterConfig | Format-List BlockedRecipients, the following is displayed:

This isn't what you expected. You wanted to add the new SMTP address to the existing list of blocked recipients, but instead the existing list of blocked recipients was overwritten by the new SMTP address. This is how modifying a multivalued property differs from modifying a property that accepts only a single value. When you modify a multivalued property, you must make sure that you append or remove values instead of overwriting the whole list of values. The following sections show you how to do exactly that.

Note:

Some cmdlets, such as Set-TransportRule, do not support modifying properties on objects in the manner described in this topic. For more information about how to add values to and remove values from the multivalued properties of these cmdlets, see the topics for those cmdlets, such as Set-TransportRule.

To modify multivalued properties, you must understand the following concepts:

Next, you have to add the value that you want to append to the BlockedRecipients property on the object that is stored in the variable $Example. Be aware that this step only adds the value to the object that is stored in the variable. To add chris@contoso.com to the BlockedRecipients property on the object that is stored in the variable $Example, run the following command:

If you want to append many values at the same time to a multivalued property, perform the same step as described earlier. When you specify the values that you want to append, separate the values by using commas as in the following example:

Chances are that you may want to remove only one value from a multivalued property instead of removing all the values at the same time. Removing a value from a multivalued property is like appending a value. However, unlike appending values, you must remove values one at a time. Again, assume that the BlockedRecipients property contains the values that are listed in the first section.

First, you must assign the object that you want to modify to a variable, as in the following example: