SetSingleValue
Applies To: Forefront Identity Manager 2010
This is an example of a Windows PowerShell function that sets an attribute value on an instance of an ImportObject object. For more information, see FIM Windows PowerShell Cmdlet Examples.
SetSingleValue Function
This function sets the value for a single-valued attribute for a given ImportObject object by using the CreateImportChange and AddImportChangeToImportObject helper functions. Because the attribute is not a multivalued attribute, the Operation parameter that is passed to the CreateImportChange function indicates that the previous value for the attribute will be replaced. For more information, see AddMultiValue and RemoveMultiValue.
# Operations
# 0 = Add
# 1 = Replace
# 2 = Delete
function SetSingleValue
{
PARAM($ImportObject, $AttributeName, $NewAttributeValue, $FullyResolved=1)
END
{
$ImportChange = CreateImportChange -AttributeName $AttributeName -AttributeValue $NewAttributeValue -Operation 1
$ImportChange.FullyResolved = $FullyResolved
AddImportChangeToImportObject $ImportChange $ImportObject
}
}
Remarks
This is a basic function that is reused by other example functions, such as the CreatePerson function and the CreateGroup function. Those functions create an ImportObject object, use the SetSingleValue function to set the attribute values on that object, and commit the changes to the Forefront Identity Manager (FIM) Service.
See Also
Concepts
FIM Windows PowerShell Cmdlet Examples
CreateImportChange
AddImportChangeToImportObject
AddMultiValue
RemoveMultiValue