FIM 2010 R2 Portal: How to use the UocFileUpload control

This technet article tells you about the control. I want to talk about how I used it.

I am using the control to upload a file from the user’s workstation and process the data via a powershell workflow. Declare a string text attribute and attach to the resource object. In the RCDC file enter the control.

<my:Control my:Name=”SampleDynamicFileUploadControl” my:TypeName=”UocFileUpload” my:Caption=”{Binding Source=schema, Path=ATextAttribute.DisplayName, Mode=OneWay}” my:Description=”{Binding Source=schema, Path=ATextAttribute.Description, Mode=OneWay}” my:RightsLevel=”{Binding Source=rights, Path=ATextAttribute}”>
<my:Properties>
<my:Property my:Name=”Required” my:Value=”{Binding Source=schema, Path=ATextAttribute.Required}”/>
<my:Property my:Name=”ContentType” my:Value=”Text”/>
<my:Property my:Name=”Value” my:Value=”{Binding Source=object, Path=ATextAttribute, Mode=TwoWay}”/>
</my:Properties>
</my:Control>

The text file is going to be read from the fileupload attribute to process bulk updates in FIM. So it will be a file with several records separated by line breaks.

When the PS workflow runs it will read this field and it sees it as one single record data stream. It is not like a Get-Content command which already recognizes line breaks and is able to separate records. So write in this format

$MyFileContent= $MyResourceObjectInstance.ATextAttribute

$MyFileRecords=($MyFileContent -Split “`r`n”)

# go through each record. Remember that there is a carriage return on the last record so put a “-1” on the record count.

For($i=1;$i -lt $MyfileRecords.count-1;$i++){

#Process record

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s