Import and Export
How to import and export content and schema between Umbraco environments and projects
What is import and export?
The import and export feature of Umbraco Deploy allows you to transfer content and schema between Umbraco environments. Exports are made from one environment to a .zip
file. And this file is imported into another environment to update the Umbraco data there.
When to use import and export
Umbraco Deploy provides two primary workflows for managing different types of Umbraco data:
Umbraco schema (such as document types and data types) are transferred as
.uda
files serialized to disk. They are deployed to refresh the schema information in a destination environment along with code and template updates.Umbraco content (such as content and media) are transferred by editors using backoffice operations.
We recommend using these approaches for day-to-day editorial and developer activities.
Import and export is intended more for larger transfer options, project upgrades, or one-off tasks when setting up new environments.
As import and export is a two-step process, it doesn't require inter-environment communication. This allows us to process much larger batches of information without running into hard limits imposed by Cloud hosting platforms.
We are also able provide hooks to allow for migrations of artifacts (such as data types) and property data when importing. This should allow you to migrate your Umbraco data from one Umbraco major version to a newer one.
Exporting content and schema
To export content and schema, you can select either a specific item of content, or a whole tree or workspace.
When exporting, you can choose to include associated media files. Bear in mind that including media files for a large site can lead to a big zip file. So even with this option, you might want to consider a different method for transferring large amounts of media. For example using direct transfer between Cloud storage accounts or File Transfer Protocol (FTP).
If your account has access to the Settings section, you can also choose to include the schema information and related files as well.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F867571021-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FB2rzIQJQmJxHBEdpijuR%252Fuploads%252Fgit-blob-a1f8df05cb664f98ba5fc83c045925fd2e0b5f97%252Fexport-dialog.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=7c85d468&sv=1)
Umbraco Deploy will then serialize all the selected items to individual files, archive them into a zip file and make that available for download. You can download the file using the Download button.
After the download, you should also delete the archive file from the server. You can do this immediately via the Delete button available in the dialog.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F867571021-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FB2rzIQJQmJxHBEdpijuR%252Fuploads%252Fgit-blob-81d50b2dca7af917f4469a3b484924fc9709b6dc%252Fexport-dialog-complete.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=bd2c06f&sv=1)
If you miss doing this, you can also clean up archive files from the Umbraco Deploy dashboard in the Settings section.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F867571021-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FB2rzIQJQmJxHBEdpijuR%252Fuploads%252Fgit-blob-718c3c55aab811c5d0dae31d7e12d083a46101d7%252Fdelete-exports.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=4d47ed86&sv=1)
The exported archive files are saved to the Umbraco temp folder in the Deploy\Export
sub-directory. This is a temporary (non-persistent) location, local to the backoffice server and therefore shouldn't be used for long-term storage of exports. You can also only download the file from the export dialog in the backoffice.
Importing content and schema
Having previously exported content and schema to a zip file, you can import this into a new environment.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F867571021-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FB2rzIQJQmJxHBEdpijuR%252Fuploads%252Fgit-blob-1c012d578d1c45b92f3025db3c970ad3cb6d5f57%252Fimport-dialog.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6270e621&sv=1)
You can upload the file via the browser.
Similar to when exporting, you can choose to import everything from the archive file, or only content, schema or files.
Deploy does not touch the default maximum upload size, but you can configure this yourself by following the CMS documentation. On Umbraco Cloud, the upload size limit is 500 MB.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F867571021-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FB2rzIQJQmJxHBEdpijuR%252Fuploads%252Fgit-blob-6d02e0e77ac556f3f2a4b896b24f4253bab40803%252Fimport-dialog-2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=a1420378&sv=1)
We validate the file before importing. Schema items that content depends on must either be in the upload itself or already exist on the target environment with the same details. If there are any issues that mean the import cannot proceed, it will be reported. You may also be given warnings for review. You can choose to ignore these and proceed if they aren't relevant to the action you are carrying out.
The import then proceeds, processing all the items provided in the zip file.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F867571021-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FB2rzIQJQmJxHBEdpijuR%252Fuploads%252Fgit-blob-b2a24da8d380dec31858c1b7beb581a5bcb0f0a1%252Fimport-dialog-3.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=7f47ca0b&sv=1)
Once complete or on close of the dialog, the imported file will be deleted from the server. If this is missed, perhaps via a closed browser, you can also delete archive files from the Umbraco Deploy dashboard in the Settings section.
Migrating whilst importing
It is possible to migrate schema and content whilst importing. For example, to change Data Type using Nested Content to Block List and ensure content data is imported to the correct Block Editor format.
Deploy contains base classes and implementations to handle common migrations that need to be registered in code, as explained in Import with migrations.
Migrating from Umbraco 7
The import and export feature is not available in Deploy 2 for Umbraco 7. We have though released a package to allow creating an export. This needs to be done in code and requires additional legacy migrators to be able to import into a newer version. This is explained in Migrating from Umbraco 7.
Service details (programmatically importing and exporting)
Underlying the functionality of import/export with Deploy is the import/export service, defined by the IArtifactImportExportService
.
You may have need to make use of this service directly if building something custom with the feature. For example you might want to import from or export to some custom storage.
The service interface defines two methods:
ExportArtifactsAsync
- takes a collection of artifacts and a storage provider defined by theIArtifactExportProvider
interface. The artifacts are serialized and exported to storage.IArtifactExportProvider
defines methods for creating streams for writing serialized artifacts or files handled by Deploy (media, templates, stylesheets etc.).
ImportArtifactsAsync
- takes storage provider containing an import defined by theIArtifactImportProvider
interface. The artifacts from storage are imported into Umbraco.IArtifactImportProvider
defines methods for creating streams for reading serialized artifacts or files handled by Deploy (media, templates, stylesheets etc.).
Implementations for IArtifactExportProvider
and IArtifactImportProvider
are provided for:
A physical directory.
An Umbraco file system.
A zip file.
These are all accessible for use via extension methods available on IArtifactImportExportService
found in the Umbraco.Deploy.Infrastructure.Extensions
namespace.
The following example shows this service in use, importing and exporting from a zip file on startup:
Last updated