2

i have name,path and type column in my Excel sheet for content porting.now i have to create export.xml form the Excel sheet data.so it might save my time for (item selection) in content porter.so i can use load wizard(to load Export.xml) which generate CP package.Is there any better solution using content porter API. if any post,references.. please, thanks in Advance.

3 Answers 3

5

If you're using TCM 2013 SP1, you can use ImportExport API. Having WebDAV URL or TCM URI of items you want to export, you can execute something like this:

var client = new ImportExportServiceClient();
var selection = new[] { new ItemsSelection(itemsList) };
string processId = client.StartExport(selection, new ExportInstruction());

Each item in the itemsList will be exported (together with their dependencies).

You can also group your items into bundle and export all items in it in one go:

var selection = new[] { new SubtreeSelection(bundleOrSearchFolderId, includeRootContainer: false) };

If you can get all your items as a result of search query (like all items modified yesterday), you can save search folder with that query and export its content the same way as it was done with bundle.

4
  • hey @AntonM thanks,i achived exporting using your post but i have one question when i tried to download pkg using var stream1 = client1.DownloadProcessLogFile(processId, false); var stream = client1.DownloadPackage(processId, false); so i am getting """"file not found """exception.but exporting is happening properly.why it is?
    – Pankaj786
    Commented Dec 12, 2014 at 13:09
  • @Pankaj786 that might happen if you don't wait for the export to complete. Package becomes available when process is in Finished state. Here is an example on how to poll the server: tridioninternals.blogspot.nl/2014/01/…
    – AntonM
    Commented Dec 13, 2014 at 10:43
  • nice work @AntonM...your blogs help me a lot in automating content porting.Thanks you very much...
    – Pankaj786
    Commented Dec 15, 2014 at 7:14
  • i followed your blogs so i am able to automate content porting i am getting export package and import package but ............can we get export and import xml too????.
    – Pankaj786
    Commented Dec 15, 2014 at 12:30
5

Have you thought about using Bundles for keeping track of what to release with Content Porter. This article has one approach (automatically tracking stuff which is changed), but you can also add items manually to a bundle as part of the dev process.

Regardless of whether you add the items manually or automatically into the bundle, once you have a bundle of items its easy just to select the bundle with Content Porter to trigger the export. If I remember rightly, the only subtlety is that if you select a bundle with the Content Porter GUI, you should click again and explicitly choose select children, as by default it does not, meaning the bundle has no items selected.

Take care with where you create your bundle(s) in the blueprint however, typically I create them as low as possible in the BP tree and add the items in from that lowest publication. Content porter will take care that blueprinted items are ported from the correct parent publication, so you don't have to worry about that.

2
  • yes @will its correct but what if we have already modified pages and component.this process is good when we do initial setup(structuring of organizational item) then only event handler help to note down process(changes in component and pages) else where i don't think it will help..and thanks for Answer.
    – Pankaj786
    Commented Dec 9, 2014 at 13:23
  • 1
    Indeed, if you already have a spreadsheet with thousands of items, then you need some automation to deal with this current case. However presumably this spreadsheet was created by manual actions - what I am suggesting is instead of recording stuff in Excel in future, you record it in a bundle (either manually or automated)
    – Will Price
    Commented Dec 9, 2014 at 13:30
3

There is some code around that can generate the XML that Content Porter uses, it's linked in Nuno's answer here: How can Content Porter be automated to move commonly changed items between environments?

One of our guys (Chris Eccles) used it to make an experimental tool a while ago which creates a Content Porter package, maybe you could do something similar?

Although, since you're on 2013 SP1 maybe the Import-Export service changes your approach somewhat. The later stages of Dom's post here: http://www.indivirtual.nl/blog/sdl-tridions-importexport-api-end-content-porter/ might point you in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.