DocumentQuery and Coupled Custom Page Type Fields

Brenden Kehren asked on September 16, 2015 16:55

I have a very simple document query that is not returning the coupled page type data. I can see it returning the treenode data but none of the coupled data. What simple property have I not set?

    var source = DocumentHelper.GetDocuments("custom.pagetype")
                .OnCurrentSite()
                .Path("/My-Url" PathTypeEnum.Children)
                .OrderBy("LastName,FirstName")
                .Columns("DocumentName", "FirstName", "LastName", "Degree", "DocumentNodeID");

    foreach (var s in source)
    {
        string name = s.GetStringValue("LastName", "") + ", " + s.GetStringValue("FirstName", "");            
    }

Correct Answer

Brenden Kehren answered on September 16, 2015 22:37

@Jeroen, that method returns the non-coupled data which doesn't help.

After some more research, I found the issue is with workflow. The pages were in workflow and all of them had been updated although none of them had been published with the new information.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Joshua Adams answered on September 16, 2015 19:20

Are the children all of the same page type? What values does s have?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 16, 2015 19:49

They are all the same page type because I'm getting only 'custom.pagetype'. The "s" value returns a node with all the document information. Unfortunately I can't see the actual coupled data. When I run the query that is generated, I get all the data I'm expecting though. I'm wondering if it doesn't have to do with versions and publishing. I think the documents that were updated weren't published so it may still be looking at the currently published version and not the new one.

1 votesVote for this answer Mark as a Correct answer

Jeroen Fürst answered on September 16, 2015 21:44

Hey Brenden :) Try this:
var documents = DocumentHelper.GetDocuments()
   .Type("custom.pagetype", q => q.Columns
("DocumentName", "FirstName", "LastName", "Degree", "DocumentNodeID")
    .Path("/My-Url", PathTypeEnum.Children)
    .OrderBy("LastName,FirstName"))
  .OnCurrentSite();

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.