Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a Sharepoint 2013 Tasks App which I am accessing using CSOM. It contains SubTasks. I would like firstly (1) to get the Tasks excluding the SubTasks, and then (2) when I get a Task, to get it's SubTasks.

(1) After looking in a Task ListItem I noticed that SubTasks have a ParentId field that lists the lookup value of their parent task. So I thought to get only the top level tasks I'd get all tasks where the ParentId is empty. I tried:

List list = context.Web.Lists.GetByTitle(TaskListTitle);
CamlQuery query = new CamlQuery();
query.ViewXml =
    @"<View>
        <Query>
            <Where>
                <IsNull><FieldRef Name='ParentId' /></IsNull>
            </Where>
        </Query>
    </View>";
ListItemCollection items = list.GetItems(query);

But it returns the Server Exception "One or more field types are not installed properly. Go to the list settings page to delete these fields." As a temporary solution I have just returned all tasks and filtered on those, but when there will be many tasks and subtasks this query will become huge so I'm hoping to get something better.

(2) Moving on to my second objective (get all Subtasks for a specific parent Task). I having tried getting the subtasks by searching all tasks where the ParentId of a task equals the specific parent ID, but as well as also giving me the error I listed in (1), I'm hoping I can get SubTasks through the parent Task ListItem to avoid a second query. Is this possible?

Thanks

Edit: I also posted this question here.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Well I can't believe I didn't check, but the ParentId should be ParentID, a typo. I got the answer from here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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