标签:style blog http color os ar sp div on
1. CAML是顺序操作,如果要实现类似 “A or B or C or D” 的结果,最好写成 “(((A or B) or C) or D)”的形式,但写成 “((A or B) or (C or D))” 也可以正常工作;
2. CAML中对时间操作时,时间格式为 “yyyy-MM-ddTHH:mm:ssZ”,需要注意T和Z都需要大写,例如:2014-10-29T14:45:00Z;
3. 以下代码用于检测当前时间段内的会议室是否已被预订:
var camlQuery = new SP.CamlQuery(); var queryXML= "<View><Query>" + "<ViewFields>" + "<FieldRef Name=‘Title‘ />" + "<FieldRef Name=‘EventDate‘ />" + "<FieldRef Name=‘EndDate‘ />" + "<FieldRef Name=‘Meeting_x0020_Room‘ />" + "<FieldRef Name=‘ID‘/>" + "</ViewFields>" + "<Where>" + "<And>" + "<Or>" + "<Or>" + "<Or>" + "<And>" + "<Leq>" + "<FieldRef Name=‘EventDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>" + startDateTime +"</Value>" + "</Leq>" + "<Gt>" + "<FieldRef Name=‘EndDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ startDateTime +"</Value>" + "</Gt>" + "</And>" + "<And>" + "<Lt>" + "<FieldRef Name=‘EventDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ endDateTime +"</Value>" + "</Lt>" + "<Geq>" + "<FieldRef Name=‘EndDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ endDateTime +"</Value>" + "</Geq>" + "</And>" + "</Or>" + "<And>" + "<Geq>" + "<FieldRef Name=‘EventDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ startDateTime +"</Value>" + "</Geq>" + "<Leq>" + "<FieldRef Name=‘EndDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ endDateTime +"</Value>" + "</Leq>" + "</And>" + "</Or>" + "<And>" + "<Leq>" + "<FieldRef Name=‘EventDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ startDateTime +"</Value>" + "</Leq>" + "<Geq>" + "<FieldRef Name=‘EndDate‘ />" + "<Value Type=‘DateTime‘ IncludeTimeValue=‘TRUE‘>"+ endDateTime +"</Value>" + "</Geq>" + "</And>" + "</Or>" + "<Eq>" + "<FieldRef Name=‘Meeting_x0020_Room‘ />" + "<Value Type=‘Lookup‘>"+ meetingRoom +"</Value>" + "</Eq>" + "</And>" + "</Where>" + "</Query></View>"; camlQuery.set_viewXml(queryXML); this.collListItem = oList.getItems(camlQuery);
4.
标签:style blog http color os ar sp div on
原文地址:http://www.cnblogs.com/qijiage/p/4059462.html