0

I need to find the check out date for any tridion item in 2013 SP1 using core service. Presently I am using this piece of code - but it is throwing null exception, reason being that there is no attribute 'CheckOutDate" and also there is no such attribute to find it.

using (SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient(binding))
            {
                RepositoryLocalObjectsFilterData filter = new RepositoryLocalObjectsFilterData();
                XElement checkedOutItemsXml = client.GetSystemWideListXml(filter);
                foreach (XElement tridionItem in checkedOutItemsXml.Nodes())
                {
                    String revDt = tridionItem.Attribute("CheckOutDate").Value; // null exception
            } 

What else I can do to find the same.

  • 1
    The only thing I can suggest you to do is learn copy and paste...read this: tridion.stackexchange.com/questions/1002/… – Pankaj Gaur Nov 24 '14 at 22:14
  • Pankaj, it doesn't gives you the date for any checkout item. I need to check in any item if it's been checked out for 3 or more days – user1671632 Nov 24 '14 at 22:23
  • Check the item history for the previous version's date – Nickoli Roussakov Nov 25 '14 at 0:53
  • 1
    Nicole, I understand the trick now. The item's last revision dt and the locked since dt is always same for checked out ones. Hence using the previous version's date solves the purpose. – user1671632 Nov 25 '14 at 20:30
9

The XML you are getting back from GetSystemWideListXml is just basic information about the items. If you actually output the XML, you'd see that indeed there is no such "CheckedOutDate" attribute. However if you take a look at the CoreService API, you'll see that the RepositoryLocalObjectData contains a LockInfo property, which has the date that I believe you are looking for.

Here's a very quick sample of something along the lines of what you could attempt to get you going on the right track:

ReadOptions readOptions = new ReadOptions();
RepositoryLocalObjectsFilterData filter = new RepositoryLocalObjectsFilterData();

XElement checkedOutItems = client.GetSystemWideListXml(filter);
foreach (XElement item in checkedOutItems.Elements())
{
    RepositoryLocalObjectData checkedOutItem = 
        client.Read(item.Attribute("ID").Value, readOptions) as RepositoryLocalObjectData;
    Console.WriteLine(checkedOutItem.Title + " checked out since " + checkedOutItem.LockInfo.LockDate);
}

Hope that helps!

|improve this answer|||||
  • RepositoryLocalObjectData doesn't contain the LockInfo property as per the VS IDE. – user1671632 Nov 25 '14 at 17:56
  • 1
    @user1671632 - As Alex says, this is "something along the lines of what you could attempt to get you going on the right track". He did not say that you should copy and paste it and it would work. I would suggest that you head to the SDL LiveContent documentation (login required) and download the API documentation to get the specifics on the methods and properties available. As a polite side note, you will get more support here if you can show that you have put reasonable effort into solving the problem yourself first before asking for help here. – Jonathan Williams Nov 25 '14 at 20:36
  • LockInfo certainly is a property on RepositoryLocalObjectData. – Peter Kjaer Nov 27 '14 at 9:11

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.