Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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" />
    <ViewFields>
      <FieldRef Name="DocIcon"/>
      <FieldRef Name="LinkFilename"/>
      <FieldRef Name="Modified"/>
      <FieldRef Name="Editor"/>         
    </ViewFields>
    <RowLimit>20</RowLimit>
    <Query>
      <OrderBy>
        <FieldRef Name="Created"/>
      </OrderBy>
      <Where>
        <Eq>
          <FieldRef Name="CheckoutUser"/>
          <Value Type="Integer">
            <UserID Type="Integer"/>
          </Value>
        </Eq>
  </View>

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

3 Answers 3

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.. :( –  Jinxed Oct 18 '13 at 4:46

Your Answer

 
discard

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.