0

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

New contributor
Vivekanand Ade is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

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

filename:budget.xlsx
PATH:http://hogwarts.com/sites/firstyear/Gryffindor*

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

  • 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 yesterday
  • Glad it helped...please upvote and mark as answer for other's reference. – Siddharth Vaghasia yesterday

Your Answer

Vivekanand Ade is a new contributor. Be nice, and check out our Code of Conduct.

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.