In the 3.x and 4.x versions of Alfresco, the ability to import and export ACP files was available from the user interface of the Alfresco Explorer client. But starting in version 5.x, the Explorer client is no longer available and, unfortunately, the ability to import and export ACP files is not available from the standard Alfresco Share UI. (Although this is a feature that is available within the Alfresco Records Management Share extension).
An ACP file consists of an XML file and a directory that contains the flat list of files for the exported content. Note that the files exported into the ACP are renamed to avoid any naming conflicts with the original content file names. The XML file represents the complete description of the exported folder hierarchy and the metadata of the folders and documents. References in the XML identify and match metadata with the files stored in the exported folder of content.
// Export ACP var nodeToExport = companyhome.childByNamePath("Sites/swsdp/documentLibrary") var exportAction= actions.create("export"); exportAction.parameters['store'] = "workspace://SpacesStore"; exportAction.parameters['package-name'] = "ACPexport"; exportAction.parameters['destination'] = companyhome; exportAction.parameters['include-children'] = true; exportAction.parameters['include-self'] = false; exportAction.parameters['encoding'] = "UTF-8"; exportAction.execute(nodeToExport);
Now, as a simple example to import this ACP file, let's create a new site called swsdp2.The target location that the previously exported ACP file will be imported into is the document library of this new site.
// Import ACP var targetNodeForImport = companyhome.childByNamePath("Sites/swsdp2/documentLibrary"); var ACPFile = companyhome.childByNamePath("ACPexport.acp"); var importAction = actions.create("import"); importAction.parameters.encoding = "UTF-8"; importAction.parameters.destination = targetNodeForImport; importAction.execute(ACPFile);
After running this script, we get a copy of all of the content that was exported into the ACP file: the folders, documents and metadata that were in the original site.