Migrating SharePoint List Data with Properties from On-Premise SharePoint to SharePoint Online

Migrating SharePoint List data, along with its properties, from on-premise SharePoint to SharePoint Online can seem like a daunting task. However, with proper planning and execution, the process can be smooth and seamless. In this blog post, we will provide a step-by-step guide on how to perform this migration using PowerShell scripts.

Step 1: Preparation

Before diving into the migration process, it’s crucial to evaluate and prepare both the source and target environments. Here’s a checklist to help you prepare:

  • Assess your on-premise SharePoint environment, including the lists and their properties.
  • Identify any customizations, workflows, or InfoPath forms that might require special handling during the migration.
  • Set up your SharePoint Online environment if you haven’t already.
  • Ensure you have the necessary permissions and access to both environments.

Step 2: Export List Data from On-Premise SharePoint

To export the list data, including metadata and properties, from on-premise SharePoint, you can either use the out-of-the-box SharePoint Export to Excel feature or PowerShell scripts. We will use PowerShell to export the data to a CSV file.

Here’s a sample PowerShell script to export the list data:

$sourceWebURL = "http://OnPremSharePointSiteURL"
$sourceListName = "SourceListName"
$exportFilePath = "C:\ExportedListData.csv"

$web = Get-SPWeb -Identity $sourceWebURL
$list = $web.Lists[$sourceListName]
$items = $list.Items

$exportData = @()
foreach ($item in $items) {
    $exportObj = New-Object PSObject
    foreach ($field in $list.Fields) {
        if (!$field.Hidden -and $field.InternalName -ne "Attachments") {
            Add-Member -InputObject $exportObj -MemberType NoteProperty -Name $field.Title -Value $item[$field.InternalName]
    $exportData += $exportObj
$exportData | Export-Csv -Path $exportFilePath -NoTypeInformation

Step 3: Address Customizations and Dependencies

Before importing the data into SharePoint Online, you’ll need to address any customizations or dependencies:

  • Re-create or update any custom columns, views, or content types in SharePoint Online.
  • Migrate or re-implement any custom workflows or InfoPath forms.

Step 4: Import List Data to SharePoint Online

To import the list data into SharePoint Online, we will use PnP PowerShell. If you haven’t already installed it, you can do so by running the following command:

Install-Module SharePointPnPPowerShellOnline -Scope CurrentUser

Here’s a sample PowerShell script to import the list data into SharePoint Online:

$targetSiteURL = "https://YourTenantName.sharepoint.com/sites/YourSite"
$targetListName = "TargetListName"
$importFilePath = "C:\ExportedListData.csv"

Connect-PnPOnline -Url $targetSiteURL -UseWebLogin
$importData = Import-Csv -Path $importFilePath

foreach ($row in $importData) {
    $itemValues = @{}
    $row.PSObject.Properties | ForEach-Object {
        if ($_.Name -ne "ID") {
            $itemValues.Add($_.Name, $_.Value)
    Add-PnPListItem -List $targetListName -Values $itemValues

Step 5: Validate the Migration

After completing the migration, it’s important to validate the process to ensure everything is fine.

Add a Comment

Your email address will not be published. Required fields are marked *