Pretty obvious when I stopped and thought about it, that UnPublished nodes would not be in a resultset of IPublishedContent nodes.
Changing the Descendants query to use ContentService (and the appropriate changes due to handling IContent rather than IPublishedContent nodes) got me out of trouble for the time being, but I'll take a look at how I might be able to use Examine when I get the time.
Find descendants - including unpublished?
I have an UmbracoAuthorizedJsonController that responds to a request from a BackOffice requestHelper to fetch a list of nodes below a parent.
Currently using code along these lines, to fetch descendants below the parent nodeID, where the DocumentTypeAlias matches a filter list
It works fine for Published content, but now I need to also find Unpublished content... and I'm at a loss at the moment.
What should I be doing to also include unpublished nodes in my list?
Unpublished content does not appear in the cache. Only published content is created in the XML cache. You can try to use Examine.
You need to set supportUnpublished="true" in the indexer you want or you can create a custom indexer.
https://our.umbraco.com/Documentation/Reference/Config/ExamineSettings/
And then do the content filter with examine
https://our.umbraco.com/documentation/reference/searching/examine/quick-start https://24days.in/umbraco-cms/2013/getting-started-with-examine/
UPDATE
you can also use contentservice to do this search. But I recommend doing examine, avoid the database calls that contentservice does
https://our.umbraco.com/documentation/reference/management/services/contentservice/
Cheers - that fixed it.
Pretty obvious when I stopped and thought about it, that UnPublished nodes would not be in a resultset of IPublishedContent nodes.
Changing the Descendants query to use ContentService (and the appropriate changes due to handling IContent rather than IPublishedContent nodes) got me out of trouble for the time being, but I'll take a look at how I might be able to use Examine when I get the time.
is working on a reply...