问题描述
是否可以使用通过 Lists.aspx 公开的 Web 服务从 Sharepoint 的日历中获取事件列表(扩展了重复事件)?
Is it possible to get a list of events (with recurring events expanded) out of Sharepoint's Calendar using the Web Service exposed through Lists.aspx?
如果您使用 C# 或 VB,这显然是可能的,如此处 使用如下代码片段:
This is evidently possible if you are using C# or VB, as described here using a snippet like this:
SPQuery query = new SPQuery();
query.ExpandRecurrence = true;
query.Query = "<Where><DateRangesOverlap><FieldRef Name=\"EventDate\" /><FieldRef Name=\"EndDate\" /><FieldRef Name=\"RecurrenceID\" /><Value Type=\"DateTime\"><Month /></Value></DateRangesOverlap></Where>";
我试图通过 cURL 使用纯 XML 执行相同的查询:
I am trying to do the same using plain XML via cURL with this query:
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>{my guid goes here}</listName>
<query>
<Query xmlns="">
<Where>
<DateRangesOverlap>
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="RecurrenceID" />
<Value Type="DateTime"><Month/></Value>
</DateRangesOverlap>
</Where>
</Query>
</query>
<queryOptions>
<QueryOptions>
<ExpandRecurrence>TRUE</ExpandRecurrence>
</QueryOptions>
</queryOptions>
这有点工作 - 它获取所有列表项,但不会扩展重复项.关键似乎是 ExpandRecurrence 属性.令人惊讶的是,除了几篇博文之外,谷歌似乎对此事没有太多话要说.在网上搜索,我读到一些评论表明 ExpandRecurrence 属性不起作用,但其他人说它工作正常,我读过的任何内容都没有让我印象深刻.
This kinda works - it gets all the list items, but recurring items are not expanded. The key seems to be the ExpandRecurrence property. Surprisingly, Google does not seem to have a lot to say on the matter beyond a couple of blog posts. Scouring the web, I've read a few comments indicating that the ExpandRecurrence property does not work, but others say it works fine and nothing I've read has struck me as definitive.
有没有人试过这个并让它在不使用 C# 或 VB 的情况下工作——只是直接的 XML?
Has anybody tried this and gotten it to work without using C# or VB - just straight XML?
推荐答案
不可能.您需要通过 SP 对象模型使用 SP 对象模型,例如 SPQuery 对象.但这意味着您必须直接在 sharepoint 服务器上运行该代码,而不是从客户端调用.
Nope is not possible. You would need to use the SP Object model via, for example the SPQuery object. But that would mean that you would have to run that code directly on the sharepoint server, instead of calling in from a client.
这篇关于通过 Web 服务扩展 Sharepoint 日历中的重复事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!