我在 SSRS 2008 中有一个数据源指向我的 SharePoint 列表,并且我正在尝试使用 CAML 查询从 SharePoint 2010 列表中的日历中获取重复发生的事件作为不同的项目,
例:
活动 1: 01/01/2017 15:00 每天重复活动2: 02/01/2017 17:00 无经常性
预期:
( 3 行 (
1 |活动 1 2017-01-01 15:00
2 |事件 1 2017-01-02 15:00
3 |活动2 2017-01-02 17:00
实际结果:
1 |活动 1 2017-01-01 15:00
2 |活动2 2017-01-02 17:00
CAML 查询:
<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListName>Calendario</ListName>
<ViewFields>
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="Department" />
<FieldRef Name="ParticipantsPicker" />
<FieldRef Name="Facilities" />
<FieldRef Name="Category" />
<FieldRef Name="Title" />
<FieldRef Name="Description" />
<FieldRef Name="RecurrenceData" />
<FieldRef Name="fRecurrence" />
</ViewFields>
<Query>
<QueryOptions>
<ExpandRecurrence>TRUE</ExpandRecurrence>
</QueryOptions>
<Where>
<IsNotNull>
<FieldRef Name="Facilities" />
</IsNotNull>
<DateRangesOverlap>
<FieldRef Name='EventDate' />
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
<Value Type='DateTime' IncludeTimeValue="FALSE"><Month /></Value>
</DateRangesOverlap>
</Where>
<OrderBy>
<FieldRef Name='EventDate' Ascending='True' />
</OrderBy>
</Query>
</RSSharePointList>
CAML 格式不正确;<QueryOptions>
元素是 <Query>
元素的同级元素,而不是子元素。使用此修订后的 CAML 重试:
<Query>
<Where>
<IsNotNull>
<FieldRef Name="Facilities" />
</IsNotNull>
<DateRangesOverlap>
<FieldRef Name='EventDate' />
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
<Value Type='DateTime' IncludeTimeValue="FALSE">
<Month />
</Value>
</DateRangesOverlap>
</Where>
<OrderBy>
<FieldRef Name='EventDate' Ascending='True' />
</OrderBy>
</Query>
<QueryOptions>
<ExpandRecurrence>TRUE</ExpandRecurrence>
</QueryOptions>