1

我有一个内容查询 webpart,它读取日历列表并显示当前正在运行的事件

我遇到的问题是,当我设置一个重复事件时,我的查询被“破坏”了。

我的 CAML 请求:

<Where>
    <And>
        <Leq>
            <FieldRef Name="EventDate" Nullable="False" Type="DateTime"/>
            <Value Type="DateTime" IncludeTimeValue="TRUE">
            <Today />
            </Value>
        </Leq>
        <Geq>
            <FieldRef Name="EndDate" Nullable="False" Type="DateTime"/>
            <Value Type="DateTime" IncludeTimeValue="TRUE">
            <Today />
            </Value>
        </Geq>
    </And>
</Where>

问题是,重复事件是用 EventDate 定义的,无论何时开始,但 EndDate 类似于从现在开始的 10 年(或4499年O_o )。

这是重复事件的身份输出(似乎没有什么可以像那样定义它......至少,从我可以玩弄的信息来看)。

Property:ListId | Value:<gibberish>
Property:WebId | Value:<gibberish>
Property:ID | Value:17
Property:Title | Value:maint
Property:FileRef | Value:SiteDirectory/mysite/Lists/Calendrier/17_.000
Property:_x007B_1d22ea11_x002D_1e32_x002D_424e_x002D_89ab_x002D_9fedbadb6ce1_x007D_ | Value:17
Property:Modified | Value:2011-07-05 10:37:02
Property:Author | Value:Admin
Property:Editor | Value:Admin
Property:Created | Value:2011-07-05 10:37:02
Property:PublishingRollupImage | Value:
Property:_Level | Value:1
Property:Comments | Value:
Property:EventDate | Value:2011-07-05 03:00:00
Property:EndDate | Value:2021-01-26 05:00:00
Property:fAllDayEvent | Value:0
Property:LinkUrl | Value:http://localhost/SiteDirectory/mySite/Lists/Calendrier/17_.000
Property:PubDate | Value:Tue, 05 Jul 2011 14:37:02 GMT
Property:ImageUrl | Value:
Property:ImageUrlAltText | Value:
Property:Description | Value:
Property:Style | Value:identity
Property:GroupStyle | Value:Band
Property:__begincolumn | Value:True
Property:__begingroup | Value:False

(此事件定义为每周一和周二发生)。

  1. 我怎么知道一个事件是否经常发生?
  2. 如何过滤我的查询以仅包含当前正在运行的周期性事件?
4

1 回答 1

0

首先要意识到的是,重复的事件系列仅作为一个事件存储,而不是作为每个单独的实例存储。

因此,开始/结束日期是如此之长 - 它是重复的总长度,而不是任何特定实例。

如果您正在处理重复事件,则有一个 fRecurrance 字段为 True。

这是您了解重复事件的唯一指南 - 但请注意,处理重复事件是一项艰苦的工作,而这就是愤怒、仇恨和痛苦……

MSDN - 了解 SharePoint 日历以及如何将其导出为 iCal 格式

于 2011-07-06T10:28:54.903 回答