I'm new to umbraco.
Here I have created a blog with 4 events here I have unpublished 2 of the events now in my website I can able to see the remaining two published events.
Now I want to display the unpublished events in a separate page so that, I have modified the query like
From
@{
.Where(x => x.IsVisible());
}
To
@{
.Where(x => x.InVisible());
}
I don't know whether it's correct or not???
What I want to do to get the unpublished event (i.e., UnPublished contents from backoffice)?????????
If you really need to get unpublished content, Sörens answer - using the ContentService - is the only way. I still don't really understand why you need to get unpublished content, though, as that's not how you're supposed to use Umbraco :-/
But okay. Have you tried getting the content using the ContentService? Did that not work? If not, how did it fail?
Maybe there's some confusion about what it means to publish/unpublish content as well? In my mind it doesn't make much sense to want to list unpublished content as it cannot be accessed anyway.
Visible/Invisible is nothing to do with Published/Unpublished. An unpublished node doesn't exist in the cache that Umbraco normally uses.
If we're talking actual events that have dates and can be in the future ("Visible") or in the past ("Invisible"), you shouldn't unpublish the past events. Instead, query by the date field(s) instead, like
To get UnPublished Contents
Hi Everyone,
I'm new to umbraco. Here I have created a blog with 4 events here I have unpublished 2 of the events now in my website I can able to see the remaining two published events.
Now I want to display the unpublished events in a separate page so that, I have modified the query like
From
To
I don't know whether it's correct or not???
What I want to do to get the unpublished event (i.e., UnPublished contents from backoffice)?????????
-Regards, Jothipriya G
Hi Jothipriya,
you can only get the unpublished content with contentservice:
https://our.umbraco.com/Documentation/Reference/Management/Services/ContentService/index-v8
https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.Services.IContentService.html
With the default razor syntax, you get only the IPublishedContent-Objects from nuCache.
Hope this helps?
Best regards, Sören
Regret for delayed. I Can't get the unpublished content still now??? Is there any other way???
If you really need to get unpublished content, Sörens answer - using the ContentService - is the only way. I still don't really understand why you need to get unpublished content, though, as that's not how you're supposed to use Umbraco :-/
But okay. Have you tried getting the content using the ContentService? Did that not work? If not, how did it fail?
Maybe there's some confusion about what it means to publish/unpublish content as well? In my mind it doesn't make much sense to want to list unpublished content as it cannot be accessed anyway.
Visible/Invisible is nothing to do with Published/Unpublished. An unpublished node doesn't exist in the cache that Umbraco normally uses.
If we're talking actual events that have dates and can be in the future ("Visible") or in the past ("Invisible"), you shouldn't unpublish the past events. Instead, query by the date field(s) instead, like
to get a list of past events and
to get a list of current or coming events.
Apologies if I've misunderstood your predicament :-)
is working on a reply...