13

I'm investigating certain operations against the Core Service for an upcoming project. I'm wondering whether its possible to retrieve the version history of a component via the Core Service? (As in, the items shown in the right-click context menu > Versioning > History).

I can retrieve the current version of any component, but can't see in the docs how I would retrieve previous versions, or a list of previous versions.

Here's the basic code I'm using to retrieve component data:

var component = (ComponentData) client.Read(componentId, 
    new ReadOptions {LoadFlags = LoadFlags.Expanded | LoadFlags.IncludeDynamicVersionInfo});

Any help would be much appreciated.

2 Answers 2

10

You need something like this

VersionsFilterData versionsFilter = new VersionsFilterData();
IdentifiableObjectData[] versionList = client.GetList("tcm:7-15210", versionsFilter );
0
4

Not sure about a list of versions but for a specific version: I believe you can append the version number onto the TCM ID. e.g. tcm:3-120-v1 would get you version 1.

1
  • This works too, but as you say, its more for retrieving a specific version of an item, rather than a list of versions.
    – James Simm
    Commented Jun 28, 2013 at 15:01

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.