内容查询 Web 部件 - 重复事件的日历问题

发布于 2024-11-18 23:03:56 字数 2100 浏览 2 评论 0原文

我有一个内容查询 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

(此活动定义为每周一和周二发生)。

  1. 如何知道事件是否重复发生?
  2. 如何过滤查询以仅包含当前正在运行的周期性事件?

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).

  1. How can I know if an event is recurrent or not?
  2. How could I filter my query to contains only currently running occurrence of a periodic event?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向日葵 2024-11-25 23:03:56

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

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

如果您正在处理重复事件,则有一个 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文