Is there anyway to get a value from an unpublished node?
Here's my code :
public JsonResult<String> GetData()
{
var id = HttpContext.Current.Request.QueryString["id"];
dynamic properties = Umbraco.Content(Convert.ToInt32(id));
return Json(properties.Data);
}
If I go to the BackOffice and chage the value of "Data" and just Save It, my method always return the last published version instead of my new saved, but unpublished one.
Keep in mind if you use the ContentService you are talking directly to the database. This approach might not scale if your site receives a lot of visitors.
Get unpublished content?
Hi!
Is there anyway to get a value from an unpublished node?
Here's my code :
If I go to the BackOffice and chage the value of "Data" and just Save It, my method always return the last published version instead of my new saved, but unpublished one.
Thanks!
Would this work? I've used this to query for reviews tagged to unpublished locations, worked great for me.
https://our.umbraco.com/forum/developers/api-questions/49595-Query-unpublished-nodes-by-property-value
There's a check in the API to see if something is published, you could just filter for the opposite.
I tried it, but when I use the getValue method from the IContent returned by the query, it always return me null.
That's said, I don't think it will see the difference between my published value and my saved value.
I finally get this to work with the API. Yeah!
Keep in mind if you use the
ContentService
you are talking directly to the database. This approach might not scale if your site receives a lot of visitors.You're right! Is there a more performant way to do this?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.