views:

50

answers:

0

I have the following snippet of code that works in MOSS 2007, but when used against SP 2010, no items are returned. The 2010 instance is a test upgrade of the content database from the 2007 farm.

Has something changed in 2010?

                        CrossListQueryInfo q = new CrossListQueryInfo();
                    q.Lists = "<Lists ServerTemplate=\"104\"/>";
                    q.Query = "<Where><And><Eq><FieldRef Name=\"ContentType\" /><Value Type=\"Text\">External Announcement</Value></Eq><Or><IsNull><FieldRef Name=\"Expires\" /></IsNull><Gt><FieldRef Name=\"Expires\" /><Value Type=\"DateTime\"><Today /></Value></Gt></Or></And></Where>";
                    //q.Query = "<Where><Eq><FieldRef Name=\"ContentType\" /><Value Type=\"Text\">ASC External Announcement</Value></Eq></Where>";
                    q.Webs = "<Webs Scope=\"SiteCollection\" />";
                    q.ViewFields = "<FieldRef Name=\"ID\" /><FieldRef Name=\"Title\" /><FieldRef Name=\"ContentType\" /><FieldRef Name=\"Expires\" Nullable=\"TRUE\" /><FieldRef Name=\"FileRef\" /><FieldRef Name=\"EncodedAbsUrl\" />";
                    q.RowLimit = 5;
                    q.WebUrl = "/";
                    q.UseCache = true;
                    CrossListQueryCache cache = new CrossListQueryCache(q);
                    dt = cache.GetSiteData(site, CrossListQueryCache.ContextUrl());
                    staffAnnouncements.DataSource = dt;

related questions