How to know if a NodeFactory node is published

1.2k Views Asked by At

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage

@using umbraco.NodeFactory; @using umbraco.MacroEngines;

    <ul class="rslides">
        @{
            var rootNode = Model.Content.AncestorOrSelf(1);
            var items = (rootNode.HasValue("featuredSlides")) ? (Umbraco.Core.Dynamics.DynamicXml)rootNode.GetPropertyValue("featuredSlides") : null;
        }
        @if (items != null)
        {
            foreach(var item in items)
            {
                int id = Convert.ToInt32(@item.InnerText);
                Node node = new Node(id);

                var mediaItem = Umbraco.TypedMedia(node.GetProperty("picture").ToString());

                int mediaHeight = Convert.ToInt16(@mediaItem.GetPropertyValue("umbracoHeight"));
                int maxHeight = 700;

                int height = (mediaHeight > maxHeight) ? maxHeight : mediaHeight;

                var url = @node.Url;

                <li><a href="@Umbraco.NiceUrl(id)"><img src="/[email protected]("umbracoFile")&width=640"></a></li>
            }
        }
    </ul>

I would like to know what is the published status of @node. I'm working with umbraco 6.1.6

I already tried something like var p = @node.GetProperty("published") (publishedCount, publishedStatus ...) but nothing worked.

Any idea?

Thanks.

1

There are 1 best solutions below

1
On

(Dynamic)Node gives access to (only) published content from the XML cache. Node has properties CreateDate and UpdateDate.