Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create Bundle Using Tridion Coreservice [C# version]
function New-TridionBundle
Creates a new bundle based on specified bundle schema.
Returns the newly created bundle.
# The title of the new bundle
# The descrition of the new bundle
# The item type of the new bundle
# ID of the parent folder.
$client = Get-TridionCoreServiceClient -Verbose:($PSBoundParameters['Verbose'] -eq $true);
$virtualFolderTypeSchema = $client.GetVirtualFolderTypeSchema("");
$bundle = _GetDefaultData $client 8192 $Parent $Title;
$bundle.Description = $Description;
$bundle.MetadataSchema.IdRef= $BundleSchemaId;
$bundle.TypeSchema.IdRef = $virtualFolderTypeSchema.Id;
$bundle.LocationInfo.OrganizationalItem.IdRef = $Parent;
$bundle.Configuration = '<Bundle xmlns=""><Items/></Bundle>';
$result = _SaveItem $client $bundle $true;
return $result;
Close-TridionCoreServiceClient $client;
public VirtualFolderData CreateBundle()
SchemaData bundleSchema = (SchemaData) _CoreServiceClient.Read("tcm:1-78-8", _ReadOption);
SchemaData virtualFolderTypeSchema =
TcmUri folderId = new TcmUri(100, ItemType.Folder, 1);
VirtualFolderData bundle = new VirtualFolderData()
Id = "tcm:0-0-0",
Title = "Test Bundle Title",
Description = "Test Bundle Description",
MetadataSchema = new LinkToSchemaData()
IdRef = bundleSchema.Id
TypeSchema = new LinkToSchemaData()
IdRef = virtualFolderTypeSchema.Id
LocationInfo = new LocationInfo()
OrganizationalItem = new LinkToOrganizationalItemData()
IdRef = folderId
bundle = (VirtualFolderData) _CoreServiceClient.Create(bundle, _ReadOption);
return bundle;
Copy link

justsayantan commented Jun 5, 2018

Here is the scripts to create bundle/bundles through PowerShell coreservice module. Though I have mentioned about the PowerShell module, but I considered to keep C# version as well, so that anyone can pick as per their preference –

To create the Bundle I have used below Parameters –

Parameter Description
Title Title of the Bundle
Description Description Of the Bundle
BundleSchemaId Id of the Bundle Schema (Based on which the Bundle will be created)
Parent Id of the Folder (Where you want to place the Bundle)

Here is an example to create a no. of Bundles at the same time –

// Here I am creating a new folder to store all the bundles at the same place

$newFolder = New-TridionItem -ItemType 2 -Parent tcm:5-27-2 -Name Bundles
Write-Host “Folder Id: ” $newFolder.Id
Write-Host “=====================”

$count = 10;
for($i=0; $i -le $count;$i++)
$title = “My New Bundle ” + $i;
$Description = “Bundle along with updated component”
$bundleid = New-TridionBundle -Title $title -Description $Description -BundleSchemaId “tcm:5-403-8” -Parent $newFolder.Id
Write-Host “New Bundle Id” $bundleid
Write-Host “=====================”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment