Tuesday, December 10, 2013

Tridion 2013 SP1 - Import Export API

Continuing with my posts related to the new Tridion 2013 SP1 release, in this opportunity I will talk about the new Import/Export API. Imagine that you want to execute Content Porter like functionality in your programs or scripts, it is now possible by using the Import/Export API.

The Import/Export API is a set of WCF services and endpoints with a set of operations that will allow you to export and import packages. Note that the next release of Content Porter will use the Import/Export API.

Developing a .NET Application that uses the Import/Export API

As the first step, we will need to add a reference to the Import/Export client dlls. You can find the DLLs in [TRIDION_HOME]\bin\client\ImportExport. Add a reference to the following DLLs.


The second step will be to add the WCF configuration settings to the configuration file, in this case I am using the app.config file.


Merge the contents of the file above into your configuration file.

As the third step I will create an instance of the ImportExport service client.

ImportExportServiceClient channel = new ImportExportServiceClient("basicHttp_2013");

Creating an Export Package

There are three steps in order to create an export package, select items, define export instructions and create the export package.

In order to select items we will need to use the Selection class and its derived classes that are listed below.



Selection selection = new ItemsSelection(new string[] { "tcm:5-1053" });

In order to define export instructions we will use the ExportInstructions class

ExportInstruction exportInstruction = new ExportInstruction() {
    BluePrintMode = BluePrintMode.ExportSharedItemsFromOwningPublication

In order to export items we will need to execute the StartExport method available in the ImportExportServiceClient class

string processId = channel.StartExport(new Selection[] { selection }, exportInstruction);

Notice that the StartExport method returns the Import/Export process id that will be used later when we perform an import operation or to follow the process status.

Importing a Package

There are two steps in order to import a package, define import instructions and import the page.

In order to define import instructions we need to use the ImportInstruction class.

ImportInstruction importInstructions = new ImportInstruction() {
    RunInTransaction = true,
    DiscoverPotentialProblems = true,
    LogLevel = LogLevel.Debug

In order to import a package we need to use the StartImport available in the ImportExportServiceClient class

string packageFullPath = string.Format("{0}ImportExport\\Packages\\export_{1}.zip", ConfigurationSettings.GetTcmHomeDirectory(), processId);
channel.StartImport(packageFullPath, importInstructions);

This API is easy and very powerful and it will open a lot of possibilities regarding content management.


  1. So... with an API, everyone will understand Content Porter now, right? :-)

  2. Nice post.
    Note, however that StartExport doesn't really return a Package name, but a Process ID which can be used in subsequent requests to get the status of the process and to download the resulting Package.
    In this example the process ID is (mis-)used to construct a full (server-side) path used for import. Normally, you would first upload a Package from the client.

  3. Thank you Rick for the clarification.

  4. Hi Eric

    I'm curious where you can find Tridion.ContentManager.ImportExport.Client.dll? I cannot seem to find it anywhere in the Tridion installation. Thanks!

  5. In your post you mentioned the Selection Class,I do not see any derived class listed for Componet Template,Page Templates and Template building block. I found that the ItemSelection Class only allows you to export Componets. If there another derived class of the seleteion Class that you did not list here?

  6. I have found that all items work using the webdavurl