简体   繁体   中英

Simple SPQuery issue

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";
                        }

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>";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM