0

I've a problem about the ParentItemID in the discussion board. I try to get it in order to do a hierarchy between the responses of a subject. I just access the title and the body of the response, and I tried things like GetParentItemID but it didn't work at all.

Here is the code of my function to get informations about the items in my discussion:

public static void GetElementList(string url, string name)
    {

        ClientContext clientContext = new ClientContext(url);
        SP.List oList = clientContext.Web.Lists.GetByTitle(name);

        CamlQuery camlQuery = new CamlQuery();
        ListItemCollection collListItem = oList.GetItems(camlQuery);

        clientContext.Load(
            collListItem,
            items => items.Include(
            item => item["Title"],
            item => item["Body"]));

        clientContext.ExecuteQuery();

        foreach (ListItem oListItem in collListItem)
        {
            Console.WriteLine("Title: " + oListItem["Title"]);
            Console.WriteLine("Body: " + oListItem["Body"]);
        }

    }

If someone can help me. I already thank people who will help me !

0

Have you tried to use the ParentFolderId instead?

Discussions have two different content types, Discussion for a new topic posted and Message for a reply to that topic.

The ID for the original discussion (topic) post is the column "ID" on that item. But the reply messages store this same number in the "Parent Folder ID" column.

1
  • Thank you for your answer ! I finally used the ThreadIndex to do the hierarchy and I used the folder type to recognize folders from answers !
    – GatLeMall
    May 20 '16 at 14:12

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.