query.Query = @"<Where>
<And>
<BeginsWith>
<FieldRef Name='ContentTypeId'/>
<Value Type='Text'>[LONG GUID]</Value>
</BeginsWith>
<And>
<Geq>
<FieldRef Name='PublishingStartDate' />
<Value Type='DateTime'>2011-01-01T15:55:52Z</Value>
</Geq>
<Leq>
<FieldRef Name='PublishingStartDate' />
<Value Type='DateTime'>2011-01-01T15:55:52Z</Value>
</Leq>
</And>
</And>
</Where>
<OrderBy>
<FieldRef Name='PublishingStartDate' Ascending='FALSE' />
</OrderBy>";
上面的查询试图在两个日期之间恢复特定内容类型的所有项目,并按相同的日期字段排序(降序)。
编辑:我应该提到这是一个 SPSiteDataQuery