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

旧城冷巷雨未停 提交于 2020-01-15 03:26:09

问题


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.



来源:https://stackoverflow.com/questions/7444042/umbraco-how-can-i-get-publish-at-remove-at-date-using-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!