You can use a Forefront Identity Manager Synchronization Service (FIM Synchronization Service) rules extension to remove a specified value from an attribute that contains multiple attribute values. The most efficient way to do this is to first calculate the new multi-valued attribute and then assign the result to the attribute.

The following examples show how to remove specified values from an attribute that has multiple values. The examples remove any attribute value that begins with smtp: from the multi-valued attribute called othermailbox. The examples first remove all values from the value collection. Each attribute value that does not begin with smtp: is then added to the value collection.

Visual Basic  Copy Code
Public Sub MapAttributesForImport(ByVal FlowRuleName As String, _
	ByVal csentry As CSEntry, _
	ByVal mventry As MVEntry) _
	Implements IMASynchronization.MapAttributesForImport

	Dim mailElement As Value

	' Create an empty string value collection.
	Dim finalValues As ValueCollection = Utils.ValueCollection("initialValue")

	For Each mailElement In csentry("othermailbox").Values
		If Not mailElement.ToString.ToLower.StartsWith("smtp:") Then
		End If

	mventry("othermailbox").Values = finalValues
End Sub
C#  Copy Code
void IMASynchronization.MapAttributesForImport(
	string  FlowRuleName, 
	CSEntry csentry, 
	MVEntry mventry)
	// Create an empty string value collection.
	ValueCollection finalValues = Utils.ValueCollection("initialValue");
	foreach(Value mailElement in csentry["othermailbox"].Values)
		if(! mailElement.ToString().ToLower().StartsWith("smtp:"))

	mventry["othermailbox"].Values = finalValues;

See Also