0

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.

1
  • your CAML query is not valid, you are missing </Where> tag Also answer by bcastilho is correct.
    – bkk
    Commented Sep 12, 2016 at 5:32

3 Answers 3

1

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

<Where><Eq><FieldRef Name="CheckoutUser" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value></Eq></Where>
1

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.

0

Please check if the following query helps:

<Query><Where><Eq><FieldRef Name="CheckoutUser"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where></Query>
2
  • I tried this query but output displays nothing. :-(
    – users1100
    Commented Oct 17, 2013 at 12:50
  • It worked for me. something else must be wrong.. :(
    – Jinxed
    Commented Oct 18, 2013 at 4:46

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.