When setting publishing start and end dates on a publishing page, these dates will be saved in the PublishStartDate and PublishEndDate fields of the publishing page. Changing the scheduling settings will result in an immediate change of the page (with the modified by and modified date properties set as well), regardless of the state of the page (draft, pending, etc.).
An interesting anomaly I have faced recently (and the source of this discovery) was that when using custom field controls to values of some custom fields and trying to access the values of PublishStartDate or PublishEndDate, these fields contain the values that were present on the ListItem when the pagelayout used to edit the publishing page has loaded.
So imagine the following flow of user actions:
- Open page for editing
- Use the Schedule button in the ribbon
- Set some scheduling dates and click ok
- Save the page
- Field controls are asked to provide values of their controls so these can be saved to the appropriate field
At this point I would expect that the following code would return the dates set in step 3:
Interestingly this is not the case, the values set in step 3 are not retained. My logic would tell me that the ListItem object would be built from scratch at step 5 resulting in the query of properties (changed in step 3). Any ideas what’s happening here?