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

Query files in document library

$
0
0

Hi,

I am trying to find files in a document library using the following code but it isn't working. These files are contained in folders. However the query returns no data. Even ran the query in U2U query builder but no luck. Can someone tell me what I am doing wrong?

SPList oList = properties.Web.Lists["Client Bills"];

            SPQuery spQuery = new SPQuery();
            spQuery.Query = string.Concat("<Where>",
                                          "<IsNotNull>",
                                          "<FieldRef Name='Completed' />",
                                          "</IsNotNull>",
                                          "</Where>");

            SPListItemCollection spListItemCollection = oList.GetItems(spQuery);

            foreach(SPListItem oItem in spListItemCollection)
            {
                oItem.Delete();
               
            }


Sherazad


Viewing all articles
Browse latest Browse all 7589

Trending Articles