Retrieve files from Sharepoint Document Library that are checked out using CSOM

%3CLINGO-SUB%20id%3D%22lingo-sub-70237%22%20slang%3D%22en-US%22%3ERetrieve%20files%20from%20Sharepoint%20Document%20Library%20that%20are%20checked%20out%20using%20CSOM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-70237%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20a%20document%20library%2C%20with%20some%20meta%20data%20fields%20that%20are%20required%20while%20uploading%20a%20document%20to%20library.%20Few%20users%20just%20upload%20the%20document%20without%20entering%20the%20metadata%20values-%20Which%20leaves%20the%20document%20in%20%3CSTRONG%3EChecked%20Out%3C%2FSTRONG%3E%20status%20that%20can%20be%20seen%20only%20by%20the%20user%20or%20the%20Administrator%20by%20going%20to%20Library%20Settings.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20using%20CSOM%20code%20by%20writing%20CAML%20query.%20But%20it%20lists%20only%20the%20documents%20that%20have%20all%20the%20meta%20data%20values%20entered%20and%20checked%20out%20to%20any%20user.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%3CQUERY%3E%3C%2FQUERY%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Consolas%22%20size%3D%222%22%3E%26nbsp%3B%3C%2FFONT%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%3CWHERE%3E%3C%2FWHERE%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CFONT%20face%3D%22Consolas%22%20size%3D%222%22%3E%26lt%3B%3C%2FFONT%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3EIsNotNull%26gt%3B%3CFIELDREF%20name%3D%22'CheckoutUser'%22%3E%3C%2FFIELDREF%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Consolas%22%20size%3D%222%22%3E%26nbsp%3B%3C%2FFONT%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Consolas%22%20size%3D%222%22%3E%26nbsp%3B%3C%2FFONT%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20get%20such%20type%20of%20files%20using%20CSOM%3F%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-73769%22%20slang%3D%22en-US%22%3ERe%3A%20Retrieve%20files%20from%20Sharepoint%20Document%20Library%20that%20are%20checked%20out%20using%20CSOM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-73769%22%20slang%3D%22en-US%22%3E%3CP%3Ealternative%20ways%20to%20do....%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1%20-%20I'm%20guessing%20for%20permission%20reasons%20you%20don't%20want%20users%20to%20view%20files%20other%20users%20have%20checked%20out%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20the%20page%20they%20upload%20the%20content%20from%2C%20create%20a%20button%20('admin'%20button%3F)%20to%20a%20seperate%20page%20with%20which%20has%20list%20webpart...select%20the%20fields%20you%20want%20visible%20and%20then%20filter%20the%20list%20on%20the%20checked%20out%20file%20and%20make%20it%20%3D%5BMe%5D%3CBR%20%2F%3E%3CBR%20%2F%3E2.%20if%20you%20don't%20want%20to%20create%20an%20alternate%20page%20to%20visit.....in%20the%20list%2C%20create%20the%20required%20view%20as%20above....filter%20to%20checkoutuser%20%3D%20%5BMe%5D.%20Then%20use%20CSS%20and%20the%20webpart%20options%20to%20hide%20the%20options%20to%20view%20other%20views%20of%20the%20list%20-%20when%20using%20CSS%20put%20target%20audience%20on%20web%20part%20so%20admins%20can%20still%20see%20full%20page%20and%20only%20the%20users%20get%20the%20limited%20options.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hi,

I have a document library, with some meta data fields that are required while uploading a document to library. Few users just upload the document without entering the metadata values- Which leaves the document in Checked Out status that can be seen only by the user or the Administrator by going to Library Settings.

 

I have tried using CSOM code by writing CAML query. But it lists only the documents that have all the meta data values entered and checked out to any user. 

<Query>

 <Where>

    <IsNotNull><FieldRef Name='CheckoutUser' /></IsNotNull>

 </Where>

 </Query>

 

Is there a way to get such type of files using CSOM?

1 Reply
Highlighted

alternative ways to do....

 

1 - I'm guessing for permission reasons you don't want users to view files other users have checked out?

 

From the page they upload the content from, create a button ('admin' button?) to a seperate page with which has list webpart...select the fields you want visible and then filter the list on the checked out file and make it =[Me]

2. if you don't want to create an alternate page to visit.....in the list, create the required view as above....filter to checkoutuser = [Me]. Then use CSS and the webpart options to hide the options to view other views of the list - when using CSS put target audience on web part so admins can still see full page and only the users get the limited options.