0

I am trying to dynamically build a predicate to only hydrate a subset of lists. But I am getting and error.

var predicate = PredicateBuilder.False<SP.List>();
var listTitles = new[] { "List One", "List Two" };
foreach (var listTitle in listTitles)
{
    predicate = predicate.Or(x => x.Title == listTitle);
}
var lists = ctx.LoadQuery(ctx.Web.Lists.Where(predicate));
ctx.ExecuteQuery();

Error: The expression x is not supported

What am I missing?

smiggleworth
  • 534
  • 4
  • 16
  • Hi @smiggleworth, did you ever come up with a solution for this? I've encountered the same problem. – Chris McAtackney Jul 09 '14 at 13:07
  • 1
    Just in case you ever come across this again, you can use the answer here: http://stackoverflow.com/a/12497283/5827 to fix the problem. The issue was (apparently) that the SharePoint Client Object Model Linq provider doesn't support Invoke in your Expressions. This alternate PredicateBuilder doesn't use Invoke. – Chris McAtackney Jul 09 '14 at 14:26

0 Answers0