{"id":1733,"date":"2016-12-06T09:32:04","date_gmt":"2016-12-06T08:32:04","guid":{"rendered":"https:\/\/blog.kodono.info\/wordpress\/?p=1733"},"modified":"2016-12-06T09:32:04","modified_gmt":"2016-12-06T08:32:04","slug":"yes-you-can-be-lazy-and-get-more-than-5000-sharepoint-items","status":"publish","type":"post","link":"https:\/\/blog.kodono.info\/wordpress\/2016\/12\/06\/yes-you-can-be-lazy-and-get-more-than-5000-sharepoint-items\/","title":{"rendered":"Yes, you can be lazy and get more than 5000 SharePoint Items"},"content":{"rendered":"<p>To reply to <a href=\"http:\/\/sympmarc.com\/2016\/11\/30\/25696\/\">this blog post<\/a> I wanted to share the same thing but with <a href=\"http:\/\/aymkdn.github.io\/SharepointPlus\/\">SharepointPlus<\/a>.<\/p>\n<p>To use the paging option and get all the content from a large Sharepoint list you can simply do the below code:<\/p>\n<pre class=\"brush:javascript\">\r\n$SP().list(\"My List\").get({\r\n  fields:\"ID,Title\",\r\n  rowlimit:5000,\r\n  paging:true,\r\n  progress:function progress(nbItemsLoaded) {\r\n    \/\/ for each new page this function will be called\r\n    console.log(\"It's still loading... already \"+nbItemsLoaded+\" items have been loaded!\");\r\n  }\r\n}, function(data) {\r\n  console.log(data.length); \/\/ -> 23587\r\n  for (var i=0, len=data.length; i&lt;len; i++) {\r\n    console.log(data[i].getAttribute(\"ID\"))\r\n  }\r\n})\r\n<\/pre>\n<p>If you only want to get the first 15,000 items, you can use the option <code>page:3<\/code>. See <a href=\"http:\/\/aymkdn.github.io\/SharepointPlus\/symbols\/%24SP%28%29.list.html#.get\">the documentation<\/a> to know more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To reply to this blog post I wanted to share the same thing but with SharepointPlus. To use the paging option and get all the content from a large Sharepoint list you can simply do the below code: $SP().list(&#8220;My List&#8221;).get({ fields:&#8221;ID,Title&#8221;, rowlimit:5000, paging:true, progress:function progress(nbItemsLoaded) { \/\/ for each new page this function will be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","hide_page_title":"","footnotes":""},"categories":[170,11,33],"tags":[123,24,151,158,117],"class_list":["post-1733","post","type-post","status-publish","format-standard","hentry","category-english","category-niveau-debutant","category-programmation","tag-english","tag-javascript","tag-niveau-debutant","tag-programmation","tag-sharepoint"],"_links":{"self":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/comments?post=1733"}],"version-history":[{"count":1,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1733\/revisions"}],"predecessor-version":[{"id":1734,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1733\/revisions\/1734"}],"wp:attachment":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}