SharePoint Rest Api Caml multiple condition query -Rest api 利用Caml多个条件查询

$.ajax({
		var cquery="<View><Query><Where><And><Geq><FieldRef Name='ReleasedDate' /><Value Type='DateTime'>2018-03-22</Value></Geq><Leq><FieldRef Name='ReleasedDate' /><Value Type='DateTime'>2018-03-28</Value></Leq></And></Where></Query></View>"

	url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/getbytitle('"+listName+"')/GetItems",
			        type: "POST",
			        headers: {
			            "accept": "application/json;odata=verbose",
			            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
			            "content-Type": "application/json;odata=verbose"
			        },
			        data: JSON.stringify({ 
			        query : {
			          __metadata: {
			            type: "SP.CamlQuery" 
			          },
			          ViewXml: caml
			        }
			      }),
			        success: function (data) {
		        		var arr=data.d.results;
					console.log(arr);
			        },
			        error: function (error) {
			            alert(JSON.stringify(error));
			        }
			    });
Rest Caml query

  

猜你喜欢

转载自www.cnblogs.com/Nigel/p/11237113.html