sharepointcamlspweb

SPCrossListQuery fails to bring back results


I am calling SPWeb.GetSiteData(anSpCrossListQuery).

It fails to bring back any results or any errors when I call it with an accidental space at the end of the CAML query <Where></Where> clause.

Anyone have an idea why?


Solution

  • SharePoint is very picky with CAML queries and gives very unhelpful and sometimes obscure errors. Obviously in this case, a simple String.Trim() will fix the problem.

    Checking your query very carefully and making sure it is well formed has fixed every problem I've had with this.