I need to get the Parent.Id of a PublishedTask using C# and CSOM. Does anyone know how?
(Client-side Object Model, Project Server Online, running on SharePoint.)
The following code does not work:
ProjContext.Load(PublishedProject.Tasks);
ProjContext.ExecuteQuery();
foreach (PublishedTask Task in PublishedProject.Tasks)
{
Console.WriteLine(Task.Parent.Id);
}
Altering the Load() method like this also doesn't work:
ProjContext.Load(PublishedProject.Tasks, t => t.Include(pt => pt.Parent))
ProjContext.Load(PublishedProject.Tasks, t => t.Include(pt => pt.Id, pt => pt.Parent))
ProjContext.Load(PublishedProject.Tasks, t => t.Include(pt => pt.Id, pt => pt.Parent, pt => pt.Parent.Id))
In all these cases, the PublishedTask.Parent is undefined. PublishedTask.Parent.Id is also undefined. An error is thrown when attempting to access any of these properties under any of these scenarios.
Does anyone know how to get the PublishedTask.Parent.Id?