Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Below is my code for checking if a page is checked out using core service. My code is running with MTS user. I have checked out the page and the condition is getting evaluated to true but once the execution reached client.UndoCheckout() method call, it is giving an exception stating

Item is not checked-out

I went back and checked in CME and the page was still checked out. Am I missing something, because this is very weird?

  PageData pageData = client.TryCheckOut("tcm:18-8339-64", new ReadOptions()) as PageData;
  if (((pageData.VersionInfo) as FullVersionInfo).LockType == LockType.CheckedOut)
    client.UndoCheckOut(pageData.Id, false, null);
catch(Exception ex)


I have even tried below and getting the same exception.

if (!pageData.IsEditable.Value)
share|improve this question
Can you add a check to print out the AllowedActions to the console? What are these values? – Dylan .. Mark Saunders Mar 4 '14 at 11:32

It might be transaction problem, for debug, try to wait for a second or two before doing UndoCheckOut.

May I ask you why are you trying to do this? You can read the page and check LockType if it's CheckedOut, or if you want to check if current user can checkeout item you can take a look at AllowedActions

share|improve this answer
Updated the code – Kris Mar 3 '14 at 8:21

First of all your code should work. its strange you are getting the error.

a question:

If you are doing un-do check out for the page, why are you checking out using TryCheckOut? Because in this case

if (((pageData.VersionInfo) as FullVersionInfo).LockType == LockType.CheckedOut)

it will always return to true.

I think you should use Read to read the page. And then un-do checkout if it is already checked out.

please try below code:

        PageData pageData = tridionClient.Read("tcm:tcm:18-8339-64", new ReadOptions()) as PageData;

        if (((pageData.VersionInfo) as FullVersionInfo).LockType == LockType.CheckedOut)
            tridionClient.UndoCheckOut(pageData.Id, false, null);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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