8.2. Target Metadata Mapping

Follow

Target metadata mapping is the process of defining for each target content type, how its metadata fields are populated.  In many cases a field may be populated with the relevant metadata field from the source item, but this feature provides the opportunity to alter the data during the migration if required. 

Some customers take the opportunity to simplify their data and reduce the number of content types and/or content of fields during migrations.

A target content type may differ from the source content type in several ways:

  • Number of metadata fields
  • Valid field values
  • Mandatory v Optional

PMA provides a rich set of capabilities to smoothly migrate metadata in such cases.

Select the appropriate Content Type mapping from the Mapped Content Types to configure mapping.

 

Picture97.png

 

Picture98.png

 

Metadata mapping configuration displays a table of target fields.  For each field, the Mapping type displays the method used to populate the field (i.e. Metadata, Constant or Function) and the Source Metadata contain information on where the value comes from (either source field name, a constant/fixed value or name of function as appliable). Use  to add new mapping to a target metadata property or  to edit existing mapping.    

For each Target Metadata field, there are 3 different methods which can be used to populate it.

  • Source Metadata - The target field is populated using the value from a specified source metadata field.
  • Constant - The target field is populated with a specified fixed value.
  • Function - The target field is populated using the output of a function or PowerShell script.  Both of which may use source properties or other values to help generate the value to populate the target field.  For example, populate the target by prefixing a string to the content in source field ‘RoomID’. 

Term stores

The setting of term store fields is supported, if multiple values need to be assigned they should be separates using ;#  e.g. Term store 1;# Term store 2.

Hidden SPO fields

When migrating to SPO by default, all fields are shown, irrespective of their hidden status.

To alter this so that hidden fields are not displayed in metadata mapping, alter the PCS configuration file, setting the configuration key to True and restarting the PCS client.

<add key="SharePoint.IsDiscoverHiddenMetaFields" value="True" />

 

8.2.1.   Populating Target using Source Metadata

Selecting the Source metadata field will display list of source metadata field available.  In this example below, the target metadata field Created is being populated by the DateCreated source metadata property.

 

Picture99.png

 

Selecting the Source metadata field will display list of source metadata field available.  In this example above, the target metadata field Created is being populated by the DateCreated source metadata property.

 

8.2.2.  Populating Target using Constant value

Use this option to specify a Constant(fixed)value for a target metadata field.

 

Picture100.png

 

8.2.3.  Populating Target using Functions

A function can take in one or more parameters and use these to generate a resulting output which is used to populate a target metadata field.  The function can either be a built-in function or a custom created function using PowerShell.

NOTE: Migration performance may be significantly impacted if using Powershell functions, especially if processing .CSV files due to the time take to execute logic for each item. So script performance should be optimized where possible, especially for larger migrations.

Target metadata population using built-in functions

Choose the Function option and then the Select option

 

Picture101.png

 

A list of function areas is displayed broken down into the following categories.

Misc, StringFunctions, Math, Date & Time,Drupal8, OCR and CustomScripts

A full list of all the functions can be found here 14.1. Built-in Functions

Expand the relevant category and select the function to use and then press the Select Function button.

 

Picture102.png

 

Once the function is selected, the next step is to configure how values are passed into that function. A table is displayed showing each input parameter that the function requires. 

The Parameter Type defines how the parameter is populated.  This can either be Constant or Metadata. The source column should either contain the value for the Constant or the source metadata field name.

 

Picture103.png

 

In this example a target field is being populated using the Concate function to join a fixed string value and the URI source metadata field.

GetMappedUser Function

Target fields of type User or Group should be mapped using the function GetMappedUser(as they are by default).  This ensures that these field types are populated correctly using the information with the security mapping table. 

Editing Built-in functions

All the built-in functions can be edited using the Picture5.png icon with the exception of those in the Misc Category.

 

Picture104.png

 

This will display details of the function including the parameters and the PowerShell that implements the function.   Each parameter can be referred to in the script as it’s parameter name.  So for example, a parameter called JobTitle will be accessible in the code as $JobTitle.

 

Picture105.png

 

The built-in SUM function normally adds two values.  In the example above, we’ve altered it to add 3 numbers.  The new parameter has been named ‘StringThree’ and is available in the script as a variable $StringThree.

All the parameters will be listed in the Test Values section where test values can be manually specified.  Use the Test Function option to execute the script using the value parameters specified to ensure it works as required.

 

8.2.4.  Populating Target using PowerShell

As well as using built in functions it’s possible to create your own functions.  This feature is a powerful way to populate the contents of target metadata fields as it allows the output of a customer written PowerShell function to populate a specified metadata field.  As with the built-in functions, a customer defined list of parameters can be specified.

Creating New Function

First, select the field to be populated with the function.  On Content Type and Meta data mapping, select the Picture5.png for the Mapped Content Type to be altered.

In the table of target metadata fields, select Picture5.png for the metadata field to be populated with PowerShell function. 

 

Picture106.png

 

On Mapping Type screen, Choose Function and then the Select button

On the Programming Functions screen select Create New Function

 

Picture107.png

 

New Function Definition

 

Picture108.png

 

Name: Name assigned for new function

Description: Description of function

Group:  From the drop down, select Custom Scripts

Parameters for this function

Use the Picture4.png option to specify parameters that the function requires.

 

Picture109.png

 

Use Picture5.pngto specify the name and datatype for each function parameter.

 

Picture110.png

 

As parameters are specified, they will appear on the test parameters area.  Use the  option to enter test values for these parameters to pass to the PowerShell script.  Use the Test Function option to execute the script using the test parameters.  The output of which will appear in the Output window.

 

Example PowerShell Function

$age_bracket=Switch($Age)

{

    {$_ -le 10}                                         {"Very Young"}

    {$_ -gt 10 -and $_ -le 17}     {"Young"}

    {$_ -ge 18 -and $_ -le 100}  {"Adult"} 

    {$_ -gt 100}                             {"Very old!"}

}

return $age_bracket + "-" +$surname

The PowerShell script will have access to the passed in parameters  So $Age and $Surname are variables which are available for the example to use.  It will use the $Age parameter to determine an ‘Age Bracket’ and concatenate that with the Surname to return this as the return value of the function which is then used to populate the Target metadata field.

Working Example

 

Picture111.png

 

Use Save once the function is completed and then the next step is to configure how values are passed to the function.  The table below will be displayed/

Use the Parameter Type field to specify whether the parameter should be populated with a constant value or a source metadata field.   Use the Picture5.png to specify details.

 

Picture112.png

When using metadata type mapping, selecting the Source field will display a dropdown list of all the metadata fields for the relevant source content type.

 

8.2.5.  Using Document ID Service

If the target SharePoint site has Document ID service feature enabled, then PMA will also allow you to map Document Id and Document ID URL fields during migration.

To add metadata mapping for Document ID and Document ID URL fields follow the steps given below:

  • Open the content type mapping Settings.
  • Select any document content type mapping.
  • Select the Document ID Target metadata field and map it to equivalent unique source metadata field or if none exists, a custom PowerShell function could be written to auto generate a unique Document ID number.
  • Document ID URL (Optional).  By default, when a Shortcut Link is migrated, the URL of the item it points to will be the exact target path the referred to item was/will be migrated to. That means if the target item is later moved, the Shortcut will no longer work.  If using the SharePoint Document ID service and, specifying this Document ID URL then this Document ID URL is populated into the Shortcut Link instead of the exact path.  This then means that the Shortcut URL would still function even if the target item the Shortcut points to is moved.

A Custom Function can be used to generate unique Document Id URL for each document by adhering to below SharePoint Document ID URL format. 

http://xxx.sharepoint.com/_layouts/15/DocIdRedir.aspx?ID=<DocID>,<DocID>

Where <DocID> is the name of the target metadata field storing the Document ID configured in steps above.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

Comments