CAML查询

发布于 2024-07-24 16:42:00 字数 544 浏览 2 评论 0原文

我想要一个 CAML 查询来从日历列表中获取事件。

我想要获取未来 30 天内的所有事件,包括今天。

到目前为止我已经:

<Where>
  <DateRangesOverlap>
    <Geq>
      <FieldRef Name=\"EventDate\" />
      <Value Type=\"DateTime\">
        <Today />
      </Value>
    </Geq>
    <FieldRef Name=\"EndDate\" />
    <FieldRef Name=\"RecurrenceID\" />
    <Value Type=\"DateTime\">
      <Month />
    </Value>
  </DateRangesOverlap>
</Where>

这不起作用:(有什么想法吗?

I'd like to have a CAML query to get the events from a calendar list.

I want to get all the events including Today in the upcoming 30 or so days.

So far I have:

<Where>
  <DateRangesOverlap>
    <Geq>
      <FieldRef Name=\"EventDate\" />
      <Value Type=\"DateTime\">
        <Today />
      </Value>
    </Geq>
    <FieldRef Name=\"EndDate\" />
    <FieldRef Name=\"RecurrenceID\" />
    <Value Type=\"DateTime\">
      <Month />
    </Value>
  </DateRangesOverlap>
</Where>

This does not work :( Any ideas?

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

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

发布评论

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

评论(2

荭秂 2024-07-31 16:42:00

正如 Nat 所说,您暗示(但未指定)您正在日历列表中使用重复事件,所以我假设这是不起作用的部分?

您需要在运行 CAML 查询之前设置 SPQuery.ExpandRecurrancesSPQuery.CalendarDate 属性,并且只能使用对象模型(而不是 Web 服务)或通过在 CAML 中设置属性。

此外 - IIRC 这只会扩展与 .CalendarDate 在同一日历月中发生的重复事件的实例,因此您必须多次运行它才能获得多月视图。

这是迄今为止我发现的涵盖重复事件的最佳参考。

欢迎来到 SharePoint 中重复事件的噩梦!

As Nat has said you hint (but don't specify) that you are using recurring events in your calendar list so I am assuming that is the part that's not working?

You need to set the SPQuery.ExpandRecurrances and SPQuery.CalendarDate property prior to running the CAML query and you can only do this using the object model, not the web services or by setting an attribute in CAML.

Further - IIRC this will only expand out instances of recurring events that occur in the same calendar month as .CalendarDate so you have to run it multiple times to get a multi-month view.

This is by far the best reference covering recurring events I have found.

Welcome to the nightmare of recurring events in SharePoint!

橙幽之幻 2024-07-31 16:42:00

重复并不实际将所有事件添加到列表中,但 CAML 只能从列表中存储的“实际”事件进行查询。

The recurrence does not actually add all the events into the list, but the CAML can only query from "actual" events stored in the list.

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