1

I am creating a functionality where I need to check if a particular list exist in SharePoint online site/web. The catch here is there would be more than 10000 lists where I am checking. I found a way to check using CSOM code which takes a minute to come back with the result. I am looking for a way which would respond to me faster. I guess REST would have unique URL for the list hence tried that but not able to find any proper information on this. I am looking for suggestions. Any suggestion will be of great help.

Thanks in advance

  • How do you know what List to look for? Or are you searching for a list? – Danny '365CSI' Engelman Jun 16 '16 at 18:28
  • We have the list title with us... – Sree Kuttan Jun 16 '16 at 18:45
0

You can invoke the REST API as below

https://siteurl/_api/web/lists/getbytitle('Test100')

If the list doesn't exists then you can expect below response

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <m:code>-1, System.ArgumentException</m:code>
    <m:message xml:lang="en-US">List 'Test100' does not exist at site with URL 'https://siteurl'.</m:message>
</m:error>
  • How fast would that be any idea?? – Sree Kuttan Jun 16 '16 at 18:47
  • It will be under a second. – Amal Hashim Jun 16 '16 at 18:47
  • But what if the list is in a subsite? – Danny '365CSI' Engelman Jun 16 '16 at 19:03
  • You can format the URL accordingly like http://sitecollection/site/site/_api.. – Amal Hashim Jun 16 '16 at 19:04
  • The error that u have listed above does it come in success or on error of ajax call?? – Sree Kuttan Jun 17 '16 at 5:48

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.