Umbraco - How can I get Publish at/Remove at date

2019-07-21 17:35发布

问题:

How can I get Publish at/Remove at date using C# in Umbraco?

回答1:

You just need to access the ReleaseDate and ExpireDate of the Document object.

var doc = new Document(nodeId);
var publishAt = doc.ReleaseDate;
var removeAt = doc.ExpireDate;


回答2:

Your post helped me a lot. Thank you! I'm a novice on Umbraco, and I have a little comment. To get it to work we need to import the businesslogic namespace:

@using umbraco.cms.businesslogic.web;

It would be obvious for experienced users, but can be useful to novices like me.