内容查询 Web 部件 - 重复事件的日历问题
我有一个内容查询 Web 部件,可以读取日历列表并显示当前正在运行的事件。
我遇到的问题是,当我设置重复事件时,我的查询出现“损坏”。
我的 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
(此活动定义为每周一和周二发生)。
- 如何知道事件是否重复发生?
- 如何过滤查询以仅包含当前正在运行的周期性事件?
I have a content query webpart that read the calendar list and display currently running events.
The issue I have is when I set up a recurring event, my query gets "broken".
My CAML request :
<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>
Problem is, recurring events are defined with an EventDate of whenever it starts, but the EndDate is something like in 10 years from now (or in year 4499 O_o ).
Here's the identity output of a recurring event (it seems nothing define it like that... at least, from the info I can toy with).
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
(This event is defined as happening every Monday and Tuesday).
- How can I know if an event is recurrent or not?
- How could I filter my query to contains only currently running occurrence of a periodic event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先要认识到的是,重复发生的事件系列仅存储为一个事件,而不是每个单独的实例。
因此,开始/结束日期是如此之长——它是重复的总长度,而不是任何特定的实例。
如果您正在处理重复事件,则有一个 fRecurrance 字段为 True。
这是您能找到的理解重复事件的唯一指南 - 但请注意,处理重复事件是一项艰苦的工作,而这会带来愤怒、仇恨和痛苦......
MSDN - 了解 SharePoint 日历以及如何将其导出为 iCal 格式
The first thing to realise is that a recurring event series is stored as just one event, not as each individual instance.
Hence the start/end dates being so long - its the total length of the recurrance, not any particular instance.
There is an fRecurrance field that is True if you are dealing with a recurring event.
This is about the only guide you will find for understanding recurring events - but heads up, working with recurring events is hard work and that way lies anger, hate and suffering...
MSDN - Understanding the SharePoint calendar and how to export it to iCal format