SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. 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

I have created a document library definition in which I want to insert a view that shows all documents which are checked out by me.

The declarative code is:

<View BaseViewID="140" Type="HTML" WebPartZoneID="Main" DisplayName="CheckedOutView" DefaultView="FALSE" MobileView="FALSE" MobileDefaultView="FALSE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/dlicon.png?rev=23" Url="Forms/Checkedout.aspx" Hidden="FALSE">
   <Toolbar Type="Standard" />
      <FieldRef Name="DocIcon"/>
      <FieldRef Name="LinkFilename"/>
      <FieldRef Name="Modified"/>
      <FieldRef Name="Editor"/>         
        <FieldRef Name="Created"/>
          <FieldRef Name="CheckoutUser"/>
          <Value Type="Integer">
            <UserID Type="Integer"/>

Now what query should I write to list all documents that are checked out by me?

The reason behind achieving this by creating view is because I found one comment here. I created the view with the condition by UI and copied the declarative code by opening that view using SharePoint Designer. But not working in my case.

share|improve this question
up vote 0 down vote accepted

I'm having results with this query, please try it:

<Where><Eq><FieldRef Name="CheckoutUser" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value></Eq></Where>
share|improve this answer

I don't have the VM available right now. But you could try the following:

Create the view from UI and then open the view by using SharePoint manager. Copy the query which is generated and then use it in your XML definition.

share|improve this answer

Please check if the following query helps:

<Query><Where><Eq><FieldRef Name="CheckoutUser"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where></Query>
share|improve this answer
I tried this query but output displays nothing. :-( – users1100 Oct 17 '13 at 12:50
It worked for me. something else must be wrong.. :( – Harshini Oct 18 '13 at 4:46

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.