1

I m trying to get all tasks, which have given task as a parent using CSOM:

projContext.Load(tasks, c => c.Where(t => t.Parent.Id == parentId));

Here projContext is a valid context and parentId is the Id of a valid task.

I get error:

[Microsoft.SharePoint.Client.ServerException] {"Unknown Error"} at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()

What is wrong? How to do it correctly? Thank you.

2
  • 1
    try this: projContext.Load(tasks, c => c.Where(t => t.Parent != null && t.Parent.Id == parentId)); Commented May 19, 2018 at 18:16
  • 1
    @Damjan Tomic, thank you VERY much for this valuable advise. It worked! Silly enough, I despaired to figure out so simple thing in several hours. Please post it as an answer. Commented May 20, 2018 at 10:54

1 Answer 1

3

Try changing the query to this: projContext.Load(tasks, c => c.Where(t => t.Parent != null && t.Parent.Id == parentId));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.