2

I want to query Calendar list and get the upcoming 2 events. How should I form my query ?

This is the query I have to read the items from required list :

var url = _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('Event')/items?$filter=Active eq 1"

2 Answers 2

3

You can add $limit in conjunction with orderby=ID desc to restrict no of returned users

/_api/web/lists/GetByTitle('Event')/items?$filter=Active eq 1$limit=2$orderby=ID desc

You can also use $top=2

/_api/web/lists/GetByTitle('Event')/items?$filter=Active eq 1$top=2
0
1
var url = _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('Event')/items?$filter=Active eq 1$top=2"
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.