3

I've finally worked through a number of syntactical challenges translating the Core Service API into PowerShell instructions for the seemingly simple task of creating a Bundle via PowerShell.

Using the code below I get the error shown:

$bundleFolderData = new-object VirtualFolderData
$location="tcm:aa-bb-2";
$bundle = $core.GetDefaultData([ItemType]::VirtualFolder, $location, $defaultReadOptions);
$bundle.Configuration = "<Bundle xmlns=""http://www.sdltridion.com/ContentManager/Bundle""><Items /></Bundle>"
$bundle.TypeSchema = new-object LinkToSchemaData
$bundle.TypeSchema.IdRef = "tcm:aa-cc-8"
$core.Create($bundle, $defaultReadOptions)

Exception calling "Create" with "2" argument(s): "Unknown Virtual Folder Type: "http://aaa.net/tridion/schemas/workflow/content-escalation". A Virtual Folder Cartridge is not registered for this type." At line:1 char:1 + $core.Create($bundle, $defaultReadOptions) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : FaultException`1

I've checked that the schema reference is the one I want to add to the Bundle and that it exists.

I've tried mixing and matching the Publication references form owning to contextual to no avail... an pointers?

4

FOUND IT.

Eventually I realised that it wasn't the schema I wanted to attribute to the Bundle - but the schema I want to base the Bundle on (hence the Virtual Folder Reference!)

Adding the following script did just the job (note that this method is better than simply getting the ID and plugging it in for transportability of the scripts in other environments and yes, I see I've used ID's in the example code above ;) )

$bundleNameSpace = "http://www.sdltridion.com/ContentManager/Bundle"
[SchemaData]$schema = $core.GetVirtualFolderTypeSchema($bundleNameSpace);
$bundleSchemaId = $schema.Id
$bundle.TypeSchema.IdRef = $bundleSchemaId
$core.Create($bundle, $defaultReadOptions)

Boom!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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