AddMultiValue

Applies To: Forefront Identity Manager 2010

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

AddMultiValue Function

This function adds an attribute value to 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 added to the attribute. For more information, see SetSingleValue.

# Operations
# 0 = Add
# 1 = Replace
# 2 = Delete
function AddMultiValue
{
    PARAM($ImportObject, $AttributeName, $NewAttributeValue, $FullyResolved=1)
    END
    {
        $ImportChange = CreateImportChange -AttributeName $AttributeName -AttributeValue $NewAttributeValue -Operation 0
        $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 RemoveMultiValue and SetSingleValue.

See Also

Concepts

FIM Windows PowerShell Cmdlet Examples
SetSingleValue
RemoveMultiValue
CreateImportChange
AddImportChangeToImportObject