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.

4
  • 1
    The only thing I can suggest you to do is learn copy and paste...read this: tridion.stackexchange.com/questions/1002/… Commented Nov 24, 2014 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 Commented Nov 24, 2014 at 22:23
  • Check the item history for the previous version's date Commented Nov 25, 2014 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. Commented Nov 25, 2014 at 20:30

1 Answer 1

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!

3
  • RepositoryLocalObjectData doesn't contain the LockInfo property as per the VS IDE. Commented Nov 25, 2014 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. Commented Nov 25, 2014 at 20:36
  • LockInfo certainly is a property on RepositoryLocalObjectData. Commented Nov 27, 2014 at 9:11

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.