Simple SPQuery issue

660 views Asked by At

I cant get this simple SPQuery working. It does not return any items. Although my document library has 5 items with Modified date as 22/08/2013 12:46

Please help me, where I am getting it wrong ?

string SPquery = @"<Where><Geq><FieldRef Name='Modified'/><Value Type='DateTime'>22/08/2013</Value></Geq></Where>";

                        SPQuery oQuery = new SPQuery();
                        oQuery.ViewAttributes = "Scope=\"Recursive\"";
                        oQuery.Query = SPquery;
                        var query = documentLibraryAsList.GetItems(oQuery);


                        foreach (SPListItem spListIem in query)
                        {
                            string s = "Sure";
                        }
1

There are 1 answers

0
Thiago Vinicius On

Seems you're using a wrong DateTime format, it should be yyyy-MM-dd. Try that

string SPquery = @"<Where><Geq><FieldRef Name='Modified'/><Value Type='DateTime'>2013-08-22</Value></Geq></Where>";