Microsoft Identity Integration Server 2003 Developer Reference |
You can use a rules extension to remove a specified value from an attribute containing multiple attribute values. The most efficient way to do this is by first calculating the new multi-valued attribute and then assigning the result to the attribute.
The following example shows how to specified values from an attribute with multiple values. The example removes any attribute value that begins with smtp: from the multi-valued attribute called othermailbox. The example first removes all values from the value collection. Each attribute value that does not begin with smtp: is then added to the value collection.
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") finalValues.Clear() For Each mailElement In csentry("othermailbox").Values If Not mailElement.ToString.ToLower.StartsWith("smtp:") Then finalValues.Add(mailElement) End If Next mventry("othermailbox").Values = finalValues End Sub
void IMASynchronization.MapAttributesForImport( string FlowRuleName, CSEntry csentry, MVEntry mventry) { // Create an empty string value collection ValueCollection finalValues = Utils.ValueCollection("initialValue"); finalValues.Clear(); foreach(Value mailElement in csentry["othermailbox"].Values) { if(! mailElement.ToString().ToLower().StartsWith("smtp:")) { finalValues.Add(mailElement); } } mventry["othermailbox"].Values = finalValues; }