Is there any way other than looping through the Files to check whether the folder or files exist in document library using clientcontext - client object model.. Can someone confirm me whether the below code will work or not. Or will it create any exception??
using(var clientContext = new ClientContext(site)) { Web web = clientContext.Web; Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl("/site/doclib/folder/filename.ext"); bool bExists = false; try { clientContext.Load(file); clientContext.ExecuteQuery(); bExists = file.Exists; } catch{ } if (bExists ) { . . } 