RemoveMultiValue

Applies To: Forefront Identity Manager 2010

This is an example of a Windows PowerShell function that removes an attribute value from a multivalued attribute on an instance of an ImportObject object. For more information, see FIM Windows PowerShell Cmdlet Examples.

RemoveMultiValue Function

This function removes an attribute value from a multivalued attribute for a given ImportObject object by using the CreateImportChange and AddImportChangeToImportObject helper functions. Because the attribute is multivalued, the Operation parameter that is passed to the CreateImportChange function indicates that the new attribute value will be removed from the attribute. For more information, see SetSingleValue and AddMultiValue.

# Operations
# 0 = Add
# 1 = Replace
# 2 = Delete
function RemoveMultiValue
{
    PARAM($ImportObject, $AttributeName, $NewAttributeValue, $FullyResolved=1)
    END
    {
        $ImportChange = CreateImportChange -AttributeName $AttributeName -AttributeValue $NewAttributeValue -Operation 2
        $ImportChange.FullyResolved = $FullyResolved
        AddImportChangeToImportObject $ImportChange $ImportObject
    }
}

Remarks

This is a basic function that is reused by other example functions, such as the AddMembersToGroup function. That function creates an ImportObject object, uses the AddMultiValue function to set the attribute values on that object, and commits the changes to the Forefront Identity Manager (FIM) Service. For more information, see SetSingleValue.

See Also

Concepts

FIM Windows PowerShell Cmdlet Examples
CreateImportChange
AddImportChangeToImportObject
SetSingleValue
AddMultiValue