Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

checking file exist or not in the sharepoint document library using c#

$
0
0
  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;




Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>