Recently, while working on a custom content aggregation solution, I stumbled upon another inconvenience in SharePoint 2007 WCM. While trying to sort the query results on PublishingStartDate I got an exception that there is no such field. I found it quite odd since the Content Type of which the pages I was querying definitely had the PublishingStartDate. I have even triple checked it in the Content Type definition, in the SharePoint Web UI and using the Imtech Fields Explorer. However, while looking at the Pages Library I have noticed that while the Content Type has been bound correctly, both the PublishingStartDate and PublishingEndDate weren't there. After deleting and binding the Content Type again I have confirmed that while both these fields exist in the Content Type they are not getting added to the Pages Library. What's more, I wasn't even able to add these fields manually!
Looking for the reason of this odd behavior I have found an article by Jan Tielens: How-to enabled scheduled publishing in a MOSS Collaboration Portal. To recap it shortly: the PublishingStartDate and PublishingEndDate are only available when both the Approval Workflow and Versioning are enabled.
What's really inconvenient about this situation is, that SharePoint actually allows you to edit values in the PublishingStartDate and PublishingEndDate fields residing on a Page Layout. Furthermore it evens allows you to save these settings without even a warning. What's even more odd: your values are being persisted so after reopening and reediting the page you will the values just as you typed them. So why there is no way to access these values?
Jan wrote about that issue more than a year ago. While it was the beginning of my adventure with SharePoint 2007 I must have missed it then. Luckily it's still there and I found really helpful and time saving. Thanks Jan!
Technorati Tags: SharePoint, SharePoint 2007, MOSS 2007, WCM