[SharePoint 2007/2010]Query SharePoint Calendar Event
首先要搞清楚日历事件的各种类型,参考文章:
| Type | Description | fRecurrence | fAllDayEvent | EventType |
| Single event |
An event created with the All Day Event and Recurrence checkboxes unselected. |
FALSE | FALSE | 0 |
| All-day event |
An event created with the All Day Event checkbox selected. |
FALSE | TRUE | 0 |
| Recurring event |
An event created with the Recurrence checkbox selected. Has a recurrence icon in the All Events view. Appears as a single master event on the All Events view, but as recurring instances on the Current Events and Calendar views. |
TRUE | FALSE | 1 |
| Recurring all-day event |
Same as above, but with the All Day Event checkbox selected at creation time. |
TRUE | TRUE | 1 |
| Recurrence exception |
Created by editing an instance of a recurring event. Has a strikethrough recurrence icon in the All Events view. |
TRUE | FALSE | 4 |
| All-day recurrence exception |
Same as above, but created by editing an instance of an all-day recurring event. |
TRUE | TRUE | 4 |
|
Deleted instance of a recurring event |
Created by deleting a instance of a recurring event. Title is prefixed with “Deleted:” in the All Events view, and is hidden in the Current Events and Calendar views. |
TRUE | FALSE | 3 |
|
Deleted instance of an all-day recurring event |
Same as above, but created by deleting an instance of an all-day recurring event. |
TRUE | TRUE | 3 |
重复事件
| Field | Value for single event | Value for recurring event |
| EventDate | Start date and time |
Start date and time set for the recurring event when it was created, which may be an earlier date than the first instance of the recurring event. |
| EndDate | End date and time |
End date and time for the last instance of the recurring event. For recurring events with no end date, this is a computed date several years in the future. |
| Duration |
The time in seconds between EventDate and EndDate. |
The duration in seconds of an individual instance of the recurring event. |
特例事件和已删除事件
| Field | Value for exception or deleted instance |
| MasterSeriesItemID |
The ID of the recurring event from which this exception or deleted instance was made. |
| RecurrenceID |
The date and time of the instance of the recurring event which this exception or deleted instance takes the place of. |
重复事件的重复模式
| Recurrence type | RecurrenceData field value |
| Daily every 1 days, no end date |
<recurrence> <rule> <firstDayOfWeek>su</firstDayOfWeek> <repeat><daily dayFrequency="1" /></repeat> <repeatForever>FALSE</repeatForever> </rule> </recurrence> |
|
Weekly every Monday, Tuesday, and Wednesday, end by 5/31/2007 |
<recurrence> <rule> <firstDayOfWeek>su</firstDayOfWeek> <repeat> <weekly mo="TRUE" tu="TRUE" we="TRUE" weekFrequency="1" /> </repeat> <windowEnd>2007-05-31T22:00:00Z</windowEnd> </rule> </recurrence> |
|
Monthly the third Wednesday of every 2 months, no end date |
<recurrence> <rule> <firstDayOfWeek>su</firstDayOfWeek> <repeat> <monthlyByDay we="TRUE" weekdayOfMonth="third" monthFrequency="2" /> </repeat> <repeatForever>FALSE</repeatForever> </rule> </recurrence> |
| Yearly every May 18, end after 10 instances |
<recurrence> <rule> <firstDayOfWeek>su</firstDayOfWeek> <repeat><yearly yearFrequency="1" month="5" day="18" /></repeat> <repeatInstances>10</repeatInstances> </rule> </recurrence> |
虽然事件的重复模式是以XML格式储存,但在使用ClientObjectModel查询时,并不需要手动去解析XML。
使用SPQuery对象查询时,需指定以下属性:
ExpandRecurrence -- 是否展开重复事件
CalendarDate -- 指定查询的参考时间
查询每日事件
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPList calendar = web.GetList(listUrl);
SPQuery caml = new SPQuery();
caml.Query = @"<Where>
<DateRangesOverlap>
<FieldRef Name='EventDate' />;
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
<Value Type='DateTime'><Today /></Value>
</DateRangesOverlap>
</Where>"; caml.ExpandRecurrence = true;
caml.CalendarDate = DateTime.Now; return calendar.GetItems(caml);
}
}
查询每周事件
caml.Query = @"<Where>
<DateRangesOverlap>
<FieldRef Name='EventDate' />;
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
<Value Type='DateTime'><Week /></Value>
</DateRangesOverlap>
</Where>";
查询每月事件
caml.Query = @"<Where>
<DateRangesOverlap>
<FieldRef Name='EventDate' />;
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
<Value Type='DateTime'><Month /></Value>
</DateRangesOverlap>
</Where>";
查询每年事件
caml.Query = @"<Where>
<DateRangesOverlap>
<FieldRef Name='EventDate' />;
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
<Value Type='DateTime'><Year /></Value>
</DateRangesOverlap>
</Where>";
[SharePoint 2007/2010]Query SharePoint Calendar Event的更多相关文章
- [Beginning SharePoint Designer 2010]探索SharePoint Designer
本章概要: 1.SharePoint Designer是如何进入到微软的工具集中去的 2.SharePoint Designer的基本特性 3.如何创建SharePoint站点 4.如何打开一个已经存 ...
- 更改SharePoint 2007/2010/2013 Web 应用程序端口号
之前创建的Web应用程序端口为80,因为其他需要要将端口更改为85,下面是具体步骤: 第一步:更改IIS绑定. 打开IIS服务管理器,右击需要更改的站点,选择编辑绑定. 在打开的网站绑定窗口,选择端口 ...
- WIN中SharePoint Server 2010 入门安装部署详解
目前流行的原始安装文件基本都是这样的:Windows Server 2008 R2+SQL Server 2008R2+SharePoint Server 2010 这个初始环境原本也无可厚非 ...
- SharePoint Server 2010 中的基本任务
SharePoint Foundation 和 SharePoint Server 概述 SharePoint Foundation 2010 是一项用于 SharePoint 网站的基础技术,它可以 ...
- SharePoint Srver 2010 资源汇总
转:http://bbs.winos.cn/thread-93681-1-1.html Microsoft SharePoint Server 2010 是适用于企业和网络的业务协作平台,可以帮助您通 ...
- 【SharePoint 2010】SharePoint 2010开发方面的课堂中整理有关问题
SharePoint 2010开发方面的课堂中整理有关问题陈希章 ares@xizhang.com1. 对于SharePoint的体系结构不甚清楚,觉得有点乱了解了就不会觉得乱了,请理解1) 场服务 ...
- SharePoint Server 2010安装图解
SharePoint Server 2010作为MOSS 2007的升级版本,自从2009年底发布Beta版本以来就备受关注,网络上已经出现了很多相关的文章,其中也不乏中文的信息. 最近SharePo ...
- SharePoint 2013/2010 中的日历重合 (Calendars Overlay)
本文介绍 SharePoint 2013/2010 中的日历重合 (Calendars Overlay). 日历重合 (Calendars Overlay)的用途就是将 不多于10个日历或日历视图聚集 ...
- 【SharePoint 2010】将Sharepoint Server 2010部署到WINDOWS 7
1.部署-安装环境: 在这里先说明一下:2007的版本中我们只能装在WINDOWS 2003 SERVER 上,这种限制在2010被彻底打破了.我们可以将它安装在VISTA/WINDOWS 7/SER ...
随机推荐
- 【Java EE 学习 24 下】【注解在数据库开发中的使用】【反射+注解+动态代理在事务中的应用service层】
一.使用注解可以解决JavaBean和数据库中表名不一致.字段名不一致.字段数量不一致的问题. 1.Sun公司给jdbc提供的注解 @Table.@Column.@Id.@OneToMany.@One ...
- UDK游戏开发基础命令
编译 增量重新编译Debug版本UnrealScript脚本 UDK.exe make -debug 增量重新编译Release版本UnrealScript脚本 UDK.exe make ...
- 在WebApi中 集成 Swagger
1. Swagger(俗称:丝袜哥)是什么东西? Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同 ...
- [Unity3D]Unity资料大全免费分享
都是网上找的连七八糟的资料了,整理好分享的,有学习资料,视频,源码,插件……等等 东西比较多,不是所有的都是你需要的,可以按 ctrl+F 来搜索你要的东西,如果有广告,不用理会,关掉就可以了,如 ...
- UVA 1513 Movie collection (树状数组+反向存储)
题意:给你n盘歌碟按照(1....n)从上到下放,接着m个询问,每一次拿出x碟,输出x上方有多少碟并将此碟放到开头 直接想其实就是一线段的区间更新,单点求值,但是根据题意我们可以这样想 首先我们倒着存 ...
- 怎样看懂Oracle的执行计划
怎样看懂Oracle的执行计划 一.什么是执行计划 An explain plan is a representation of the access path that is taken when ...
- 基于dubbo框架下的RPC通讯协议性能测试
一.前言 Dubbo RPC服务框架支持丰富的传输协议.序列化方式等通讯相关的配置和扩展.dubbo执行一次RPC请求的过程大致如下:消费者(Consumer)向注册中心(Registry)执行RPC ...
- 实现倒计时功能js
<p>系统将会在<strong id="endtime"></strong>秒后跳转到登录页!</p> [原生js实现] <s ...
- jquery ui dialog autofocus 去掉默认第一个元素获取焦点
经常在dialog窗口中第一个元素为日期控件时,打开窗口则会自动显示日期下拉框. 解决办法:在dialog的open事件中,设置父对象获得焦点. p1_dialog_seniorSearch.dial ...
- 来看看css3中的box-shadow
不谈IE,只谈谈box-shadow的具体使用方法 语法: E {box-shadow: <length> <length> <length>?<length ...