3

Can't seem to get paging working using the 2013 syntax:

_api/web/GetFolderByServerRelativeUrl('/sites/Test1/Documents')/Files?$skiptoken=Paged=TRUE&p_ID=5&$top=1

The top parameter is working but not the skiptoken.

3

There is no skiptoken, there is a skip token in the documentation

Search has different syntax

iREST iDOC

  • when using skip instead of skiptoken i get this error "The $skip expression "Paged=TRUE" is not valid." – Lior Gal Mar 21 '17 at 7:30
  • Hmm.. then the Documentation where you read this syntax is wrong ?? ... weird... usually the manuals are correct, most of this has been around for 7 years or so. Where did you read this syntax ?? – Danny '365CSI' Engelman Mar 21 '17 at 8:19
  • On several forums but there all talking about REST for sp 2013, im using sp 2016 online working with the new SPFX – Lior Gal Mar 22 '17 at 8:51
  • So you now conclude Microsofts (2013) REST Documentation does not apply to 2016? – Danny '365CSI' Engelman Mar 22 '17 at 12:39
  • 1
    The second link you give specifies that SkipToken is the way to do paging, but that's only for some SharePoint OData sources, which the documentation doesn't specify – Per Jakobsen Mar 23 '17 at 9:32
1

_api/web/GetFolderByServerRelativeUrl('...')/Files doesn't support $skiptoken option use the standard $skip option

SharePoint OData REST Queries has two "Skip" options for Paging

  • $Skip
  • $SkipToken

$Skip

$Skip is the simple and standard OData way of implementing Paging it just specifies how many items to skip.

If you're paging 15 items/files/... at a time then you specify:

$top=15&$skip=0 to get the page 1
$top=15&$skip=15 to get the page 2
$top=15&$skip=150 to get the page 11

Pros

  • Standard OData so should work with any OData "sources"
  • Simple
  • You don't have to visit prior pages to get/calculate value

Cons

  • Not "solid": Paging through list may
    • give same item on two pages if other item is inserted prior to it in used sort order
    • miss an item if other item is deleted prior to it in used sort order

$SkipToken

The "solid" paging option implemented by some SharePoint OData "sources". The format of the token is complex and not something you should ever construct yourselves:

$top=10&$skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_ID%3d10 to get page 2

Don't try to construct it yourselves. Always use href from <link rel="next" ... /> from prior "page".

Pros

  • "Solid": Items returned not depend on insert/delete of other items
  • Implemented using standard REST link rel="next"

Cons

  • Not working with a lot of OData "sources"
  • You have to visit pages in order
  • $top doest work: The expression "web/GetFolderByServerRelativeUrl('/sites/Test1/Documents')/Files$top=15&$skip=0" is not valid. </m:message> </m:error> – Lior Gal Mar 23 '17 at 15:43
  • You're missing a ? in from of the querystring parameters: web/GetFolderByServerRelativeUrl('/sites/Test1/Documents')/‌​Files?$top=15&$skip=0‌​ – Per Jakobsen Mar 24 '17 at 9:45
  • strill iget the files as i indicated in the top parameter but it always begin at the first file meaning the skip parameter have no effect. – Lior Gal Mar 26 '17 at 12:38
  • $skip=0 means skip nothing have you tried $skip=15? – Per Jakobsen Mar 26 '17 at 14:10
  • Yep i did, same result – Lior Gal Mar 27 '17 at 11:55
0

The skiptoken parameter in rest call works only on Lists/Libraries but not on relative path. Try the following url it works

/sites/Test1/_api/web/getByTitle('Documents')/Items?$skiptoken=Paged=TRUE&p_ID=5&$top=5
  • i get "Cannot find resource for the request getByTitle" – Lior Gal Mar 23 '17 at 15:40
  • use this syntax please, "/sites/Test1/_api/web/Lists/getByTitle('Documents')/Items?$skiptoken=Paged=TRUE&p_ID=5&$top=5" – Venkat Konjeti Mar 23 '17 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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