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

2019-07-21 16:53发布

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

2条回答
相关推荐>>
2楼-- · 2019-07-21 17:26

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;
查看更多
Lonely孤独者°
3楼-- · 2019-07-21 17:32

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.

查看更多
登录 后发表回答