I have library which has many folders and I have file name and want to find using name of the file from those folders (dont know in which folder that file placed). please help to write code using c# csom.

Note: library has crossed threshold limit.

Thanks Vivek


I think you can use Search API on CSOM and Use KeywordQuery syntax to restrict a particular document library and filename. This will take care of your threshold and you don't have to iterate all the folders to find a document.

For your scenario you would have to use


For details on keywords syntax https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ff394509(v=office.14)

Fore details on using CSOM for Search - https://docs.microsoft.com/en-us/sharepoint/dev/general-development/using-the-sharepoint-search-query-apis

|improve this answer|||||
  • Thanks Siddharth for your reply, Yes I tried your suggestion and it worked however in my CAML query there were typo mistake hence for me both things are working. Thanks again. – Vivekanand Ade Jul 15 '19 at 10:02
  • Glad it helped...please upvote and mark as answer for other's reference. – Siddharth Vaghasia Jul 15 '19 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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