HowTo: Use Hashmap table to read values from CSV file and set it on SPO


There can be a requirement to map and transform Metadata fields to new List values in SharePoint, we have to configure CSV-based metadata mapping, which uses PowerShell extensions and function mapping features in Migration Accelerator.

Please refer to the following step-by-step guide:

1. Metadata Mapping Sample CSV.mceclip0.png

2. Locate Proventeq Migration Accelerator PowerShell Default Module file as shown below:

image006.jpg3.Open above PowerShell Default Module file and add the PowerShell command provided below to load the above Metadata Mapping CSV into a global PowerShell object and then save the file.

$global:Groupid = Import-PVQCsvAsHashTable 'D:\proventeq\metadata\BusinessUnit.csv' 'Groupid'


4.Then launch the Migration Accelerator application in order to map the respective metadata field.

5.Select Migration Task Settings and open Content Type mapping for respective field metadata mapping

6.Select the respective field setting icon and then select mapping type as Function, as shown below:


7.Click on the Select button to launch a function mapping popup as shown below. Creating a function mapping type will allow you to reuse this mapping function in other Content Type mappings as well.

8.Add a new function by providing the following parameters:

    1. Select the Function language as PowerShell
    2. Select Group as any existing or Add a new group name.
    3. Provide the Name of the function
    4. Provide the Description of the function
    5. Add the parameter “SourceField” by clicking on ‘+’ button. Provide the Data Type as ‘string’ or ‘integer’.
    6. Provide PowerShell script to read a source field value and return it’s matching target value from the global PowerShell CSV object as shown below:

$GroupId= $MigrationItem.SI.GroupId;
$sourceValue = 'NA';
$meta = Get-PVQMetadataRow $GroupId $global:Groupid;
if($meta -ne $null)
$sourceValue = $meta.$SourceField;
return $sourceValue ;

9. Click on Save Function and then select the newly-created mapping function.
10. After creating and selecting a new function, you need to provide the necessary parameter(s) in the “List of parameters available for the function” section as shown below i.e. Select mapping type as Constant and provide the column name which needs to be retrieved from CSV as given below.


11.Click on Save button to complete the metadata mapping for this field as shown below:


Was this article helpful?
0 out of 0 found this helpful