I am trying to check whether file is available in the document library or not .... but i am getting error like item doesn't exist for this code,could you please help me in this
bool Filexists = false;
using (var clientContext = new ClientContext("https://"))
{
var list = clientContext.Web.Lists.GetByTitle("Details");
var listItem = list.GetItemById(0);
clientContext.Load(list);
clientContext.Load(listItem, i => i.File);
clientContext.ExecuteQuery();
Filexists = listItem!=null ? true : false;
}
return Filexists;