views:

39

answers:

2

Ho do I get the published date of a sitecore item? There are fields like '__created' and '__updated' but couldn't find anything for published date. I tried the following:

Sitecore.Context.Item.Publishing.PublishDate

But this only gives me date if I explicitly set it from the Content Editor. Basically I just want to print out the date the item was published.

Thanks.

+1  A: 

Try '__publish' and '__unpublish' for Publish Date and Unpublished Date accordingly.

Yan Sklyarenko
Nope, don't get anything with that. Isn't it the same as using "Sitecore.Context.Item.Publishing.PublishDate"? Only contains a value if I set it explicitly.
Sudeep
Ah, yes. That's the way it works. If you want to obtain ALL fields disregarding if it has value or not, just call item.Fields.ReadAll() for that item before reading the fields.
Yan Sklyarenko
A: 

Unfortunately you can't get a published date. We have to implement a custom way to track when items are published.

Michael Edwards
Yeah, figured that out. Might have to do it in workflow then. Ahh..
Sudeep

related questions