3

I am creating a bundle using core service same as explained here. Below is the code I am using:

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());

It works perfectly on my local tridion environment. But When I deploy and run it to my client's environment, it fails with the following message:

Unknown Virtual Folder Type: "http://www.tridion.com/ContentManager/5.0/Protocol/LocalFileCopy". A Virtual Folder Cartridge is not registered for this type.

As the error indicates that there is some problem with the Bundle's Type Schema, which is "tcm:0-2-8". So I tried browsing this in my client's environment and it returned "Local file system" protocol schema as opposed to expected "Bundle" Virtual Folder Type Schema.

I guess, "tcm:0-2-8" is a system wide item representing Virtual Folder Type Schema and have the same tcm Id on different tridion instances. But since it's not presented on my client's tridion instance, I am not able to create bundles using core service.

Is there any way to know the tcmid of Virtual Folder Type Schema on a particular instance?

How can I fix the issue?

Update: Just realize that the Updated versions are not the same:

Local: SP1

Client: Hotfix Rollup SDL Tridion 2013 SP1-1

So this could be related to the Tridion version on client's machine.

11

TCM URIs are not guaranteed to be the same across systems (quite the opposite, in fact). They are basically assigned in the order you create items. So sometimes, items might have the same URIs because they are created by the system at installation time -- but you cannot rely on it.

Anyway, what you want to do is ask the system for the Schema ID. For that, you can use the GetVirtualFolderTypeSchema method:

const BundleNamespace = @"http://www.sdltridion.com/ContentManager/Bundle";
SchemaData schema = client.GetVirtualFolderTypeSchema(BundleNamespace);
string bundleSchemaId = bundleTypeSchema.Id;
  • This is much neater than simply iterating through the existing ones and hard-coding the TCM (or updating via config) per environment. +1 ! – Dylan .. Mark Saunders Nov 30 '15 at 13:42

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.