5

I am trying to get created date of a Component using the Core Services.

I tried using versioning info, but there I can only see the modified date.

I used the below. In version List, I get all the versions with version info which has title, creation date and revision date, but creation date is returning null and revision date as modified date. Please suggest.

VersionsFilterData versionsFilter = new VersionsFilterData();
versionsFilter.IncludeRevisorDescriptionColumn = true;
IdentifiableObjectData[] versionList = client.GetList(compData.Id, versionsFilter);
1
  • Did you check 'VersionInfo' property of the component? Dec 23, 2015 at 11:50

2 Answers 2

3

Warner got it - here's the logic as you do with a c# Core Service client app:

ComponentData c = (ComponentData)coreServiceClient.Read(componentId, readOptions);
FullVersionInfo v = (FullVersionInfo) c.VersionInfo;
Console.Write(v.CreationDate);

Basically, you can use the FullVersionInfo class to get access to a versioned Item's information. The BasicVersionInfo applies to all objects - including non-versioned items - and therefore contains less information.

0
4

this one took me a while, only to realize we're both making it harder than it needs to be. You can eventually get this the way you're doing it. But, you would have to do this (and you need to translate my PowerShell code into yours...)

$filter = New-Object Tridion.ContentManager.CoreService.Client.VersionsFilterData
$filter.BaseColumns = 3
$versions = $client.GetList($itemId,$filter)
foreach ($version in $versions)
{
    $vitem = Get-TridionItem $version.Id
    write-host $vitem.VersionInfo.CreationDate
    write-host $vitem.VersionInfo.Creator.Title
}

however, this is the proverbial "long way around the barn." all versions are going to have the same creator/creation date. So, what you really need to do is get the full item, then use its version information:

$vitem = Get-TridionItem $itemId
write-host $vitem.VersionInfo.CreationDate
write-host $vitem.VersionInfo.Creator.Title

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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