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.