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.

  • 1
    try this: projContext.Load(tasks, c => c.Where(t => t.Parent != null && t.Parent.Id == parentId)); – Damjan Tomic May 19 '18 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. – Boris Zinchenko May 20 '18 at 10:54
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, privacy policy and cookie policy

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