Hello
I wonder if anyone can help. This is another example of me running into ridiculous difficulty trying to do very simple things with SP 2013
The requirement for the snippet of code is incredibly simple. Just check if a folder already exists in a document library. How tricky can that possibly be, I hear you ask? Well....
Every time this runs, I am getting ALL of the items in my document library returned - even though None of them could possibly meet the criteria specified by the CAML query. Any help (before I smash my head into the nearest brick wall in frustration) would be gratefully received.
Have a nice day
thanks
Robert
// Starting with ClientContext, the constructor requires a URL to the // server running SharePoint. ClientContext context = new ClientContext(siteUrl); // Assume that the web has a list named List l = context.Web.Lists.GetByTitle(listTitle); context.ExecuteQuery(); // In this case the library needs to have a folder the name of which // matches with the Registration Number // To-DO: add something to this CAML Query to ensure that the only item that // can be returned is a *folder* CamlQuery folQuery = new CamlQuery(); folQuery.ViewXml =String.Format( @"<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{0}</Value></Eq></Where>", new Object[] { architectRecord.RegistrationNumber }) ; ListItemCollection folItms = l.GetItems(folQuery); // context.Load( folItms, items => items.Include(item => item["Title"])); context.Load(folItms); context.ExecuteQuery(); //ListItemCollection ds = uxList.GetItems(uxCamlQuery); //uxCntxt.Load(ds, items => items.Include(item => item["Title"], item => item.ContentType, item => item["DocIcon"])); //uxCntxt.ExecuteQuery(); if (folItms.Count == 0) {folItms.Count ALWAYS returns EVERY item in the Sharepoint library