I am having problems with the multinode tree picker in umbraco 13
Whatever I try i get an error.
I am using the following line to get the treepicker contents… var treepicker = Model.Content.Value(“myTreePicker”);
When I check what is returned it is coming back with this…. System.Collections.Generic.List\1[Umbraco.Cms.Core.Models.PublishedContent.IPublishedContent]`
I am assuming it is bringing back the treepicker list correctly.
I am then using the following code to pick up each item in the list…
foreach (var item in treepicker)
{
<p>@item.Name</p>
}
You mention pick up unpublished items in the list as this query is against the publishedContentCache you simply can’t.. that’s the idea unpublished not available to the frontend.
You could use the ContentService, but that would hit the Database so expensive
You also can’t get them from the External Examine index as again by default that includes only published items…
But you could get from the Internal Examine Index, but again that’s really for the backoffice to use.
I wonder if you need to rethink your content strategy if you require unpublished items at the front end.. perhaps something as simple as as a toggle for shownInList or hiddenInList depending on the default (but I’d go for needing to toggle shownInList to stop human error and accidents of content appearing that isn’t required..) and not use published as the flag here?