I am experimenting with creating bundles and adding items to them using the Core Service, and am struggling to find examples of this.

I seem to recall someone telling me that bundles are actually virtual folders, so this is where I got to

    VirtualFolderData bundle = (VirtualFolderData)client.GetDefaultData(Tridion.ContentManager.CoreService.Client.ItemType.VirtualFolder, bundleFolderURI, new ReadOptions());
    bundle.Title = itemID;
    bundle.Description = "test";
    client.Create(bundle, new ReadOptions());

But this fails with a message "No content found". Can anyone point me in the right direction with an example of creating bundles, and adding items to the bundle?

1 Answer 1


Chris, I think.. To make it a Bundle you need to change TypeSchema to be a Bundle Schema and set another Configuration XML:

var bundle = (VirtualFolderData) client.GetDefaultData(ItemType.VirtualFolder, "tcm:2-3-2", new ReadOptions());
bundle.Configuration = "<Bundle xmlns=\"http://www.sdltridion.com/ContentManager/Bundle\"><Items /></Bundle>";
bundle.TypeSchema = new LinkToSchemaData{IdRef = "tcm:0-2-8"};
client.Create(bundle, new ReadOptions());

And to add items to the Bundle:

public static VirtualFolderData AddItemsToBundleConfiguration(this VirtualFolderData bundle, IList<string> itemIdsToAdd)
  XDocument doc = XDocument.Parse(bundle.Configuration);
  XNamespace xmlns = "http://www.sdltridion.com/ContentManager/Bundle";
  XNamespace xlink = "http://www.w3.org/1999/xlink";

  foreach (var itemId in itemIdsToAdd)
    XElement newItemNode = new XElement(xmlns + "Item",
        new XAttribute(XNamespace.Xmlns + "xlink", xlink),
        new XAttribute(xlink + "href", itemId)
    doc.Descendants(xmlns + "Items").First().Add(newItemNode);

  bundle.Configuration = doc.ToString();
  return bundle;

Read the complete story at Andrey Marchuk's blog.

NOTE: that the TypeSchema is not the Bundle Schema - Andrey explains that part here


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.