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

2
  • How do you know what List to look for? Or are you searching for a list? Jun 16, 2016 at 18:28
  • We have the list title with us... Jun 16, 2016 at 18:45

1 Answer 1

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>
6
  • How fast would that be any idea?? Jun 16, 2016 at 18:47
  • It will be under a second. Jun 16, 2016 at 18:47
  • But what if the list is in a subsite? Jun 16, 2016 at 19:03
  • You can format the URL accordingly like http://sitecollection/site/site/_api.. Jun 16, 2016 at 19:04
  • The error that u have listed above does it come in success or on error of ajax call?? Jun 17, 2016 at 5:48

Your Answer

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

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