I'm trying to get a CAML query working with dates - specifically PublishingStartDate and PublishingExpirationDate.
When scheduling an item, there is the option to select 'immediately' and 'never' for the start and end dates. My understanding of these options is that they create a null value instead of a date so I need to query for 'null or later than the start date' and also 'null or before the end date' if that makes sense.
I'm trying to use this in a query builder without much luck so any guidance in the right direction would be appreciated.
<Query>
<Where>
<And>
<And>
<Or>
<IsNull>
<FieldRef Name='PublishingStartDate' />
</IsNull>
</Or>
<Leq>
<FieldRef Name='PublishingStartDate' />
<Value Type='DateTime'>
<Today OffsetDays='0' />
</Value>
</Leq>
</And>
<And>
<Or>
<IsNull>
<FieldRef Name='PublishingExpirationDate' />
</IsNull>
</Or>
<Geq>
<FieldRef Name='PublishingExpirationDate' />
<Value Type='DateTime'>
<Today OffsetDays='0' />
</Value>
</Geq>
</Or>
</And>
</Where>
</Query>