9

How to populate an item using minor version? Am using the below code snippet.

var item = $models.getItem('tcm:222-7244-64-v1'); - Works fine.

var item = $models.getItem('tcm:222-7244-64-v1.3'); - Throws error.

I was able to get the minor version from DAL using below query as neither the CoreService nor Anguilla Framework provides it, but i need to populate the item using minor version. Could someone help me to resolve it?

select max(version)||'.'|| max(revision) as rev from items where item_reference_id='7244'

3
  • If all you need it the latest version, trying using -v0
    – Nuno Linhares
    Commented Mar 5, 2013 at 8:51
  • Am working in workflow, so has the minor version. I tried using v0, but it returns only the major version. But i need to retrieve the metadata value of minor version of an item which is in workflow. Is there any way to get the minor version even using Coreservice? I can impersonate the same. Commented Mar 5, 2013 at 9:37
  • 1
    With Core service you should be able to get the current version if you are impersonating the user that has the item checked out. Just add -v0 to the URI. PS - I'll test it later to make sure I know what I'm talking about :)
    – Nuno Linhares
    Commented Mar 5, 2013 at 9:49

2 Answers 2

6

You need to use -v0 to get the latest version (which is the major and minor version). You can only do that if you are the current lock owner of the item; since the item is in workflow, that means you need to be the current assignee of the started workflow activity -- and you need to be editing the item (have loaded it with open mode = ViewOrEdit / EditWithFallback / Edit).

While you can request other specific versions (i.e. -v1) that only works for past, checked-in versions (=major versions).

4

Thanks Nuno for saving my day. I was able to get the minor version data using 'v0' through coreservice from which am passing it to the js file. Please find below the code snippet.

Client client = new Client();
string tcmid = "tcm:222-7316-64";
IdentifiableObjectData identifiableObjectData = client.Read(tcmid, null);
if (identifiableObjectData == null) return;
FullVersionInfo fullVersionInfo = identifiableObjectData.VersionInfo as FullVersionInfo;
if (!fullVersionInfo.LockType.Value.HasFlag(LockType.NewItem))
{
    client.Impersonate("NT AUTHORITY\\SYSTEM");
    identifiableObjectData = client.Read(tcmid + "-v0", null);
}

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.