Sr. Director, Sitecore MVP
Migrating Sitecore Media Library to Content Hub. Part 2: Importing Assets Into Content Hub
This is the 2nd part of a 3-part series describing scripted content migration from Sitecore XM/XP’s Media Library to Sitecore Content Hub DAM.
The 1st part outlined exporting the list of Medial Library items (assets) into an Excel file, which can be submitted to Content Hub for processing.
This 2nd part will describe importing that previously generated file into Sitecore Content Hub and then generating another Excel file, which will be needed for the final step of the migration process, described in Migrating Sitecore Media Library to Content Hub. Part 3: Repointing Image Fields to Content Hub
In this post, I’m focusing on one migration scenario where the source of assets is Sitecore Media Library, but any system can be the source of assets for migration as long as asset URLs can be made publicly available and the migration Excel file can be created (more on Excel file format below).
Asset Import Steps
Adding migration-related fields to M.Asset Entity
In part 1, we generated a migration file, containing a couple of additional fields to help link migrated assets with their source items in Media Library:
SitecorePath. In order to bring those values to Content Hub, we’ll need to add those two fields to M.Asset schema. This can be done on the Admin→Schema page: look up and open M.Asset, add
Migration section, and then add the two above fields in it like so:
Excel file format
A couple of things to keep in mind:
- The sheet name needs to match the entity's name, so in this case, it needs to be named
M.Asset. Please rename the sheet to
M.Assetin the Excel file, previously generated in part 1 [TODO: Add link]
Filecolumn contains URLs of the Media Library items, holding assets to be migrated. Make sure URLs are correct before running the migration, or else we will end up with a bunch of empty (unusable) Asset entities in Content Hub.
Preparing for the migration
- Sitecore’s Import assets with Excel article refers to Import Excel operation, which may not be available OOTB, but it can be quickly added like so:
- Navigate to Admin→Pages screen ([your instance]/…/admin/page]
Createpage and click on
Creationcomponent on it
- In the Creation component settings, make sure
Import Exceloption is enabled
- This article describes various import settings, which may or may not apply in your case – I highly recommend reading it before proceeding with Assets mass import and updating your import settings if needed.
This part is simple: navigate to the
Create page, click on
Import Excel, and upload the file for processing.
The status of the migration job can be checked in
This might take a while… hours, even days, if the asset count is in the hundreds of thousands. You’ll need to ensure the source Sitecore instance is up and running all this time, or the migration process will fail; in this case, the simplest thing to do is delete all assets and repeat the process from the start.
This post describes how to script deletion of all assets: A script to delete all Entities of a given type in Sitecore Content Hub.
Eventually, all assets will get migrated into the Content Hub, concluding the migration process.
When assets are being migrated from Sitecore Media Library, all image and file links in the Sitecore content tree must be updated to repoint them from Media Library to Content Hub. Migrating Sitecore Media Library to Content Hub. Part 3 [TODO: add a link to part 3] Repointing Image Fields to Content Hub post describes how this can be achieved with PowerShell script.
- Migrating Sitecore Media Library to Content Hub. Part 1: Exporting Assets from Media Library
- Migrating Sitecore Media Library to Content Hub. Part 2: Importing Assets to Content Hub
- Migrating Sitecore Media Library to Content Hub. Part 3: Repointing Image Fields to Content Hub
- A script to delete all Entities of a given type in Sitecore Content Hub.
- Extending Sitecore Content Hub Export Profile
- Exporting a Large Number of Entities from Sitecore Content Hub