0

Something that retrieves the whole list is the worst answer. Something that comes back with a binary true would be the best.

The only way I can see how to do it currently involves pulling back masses of uneccessary data from the site(s).

1 Answer 1

0

Option 1: Find a list by Title It's not ideal, but you can check if the list exists using this REST query:

https://YOUR_SITE/_api/Web/Lists/?$filter=Title eq 'Documents'

It does return some metadata, but with no list items. You can reduce the amout of metadata you get by adding this header to your request:

accept: application/json; odata=minimalmetadata

Option 2. Send GET request using list URL

Send a GET request directly to the list URL

If you know a library/list URL, you can send a GET request to this URL. For example

https://YOUR_SITE/Library_THAT_DOES_NOT_EXIST

This will return a 404 status. It means that the list does not exist.

If you send a GET request to the library/list that exists, you will get 2** response, meaning it exists

https://YOUR_SITE/Shared Documents
3
  • Thanks... I have tried those. The problem is I cannot find a way to do that in PowerQuery. Option 1: I don;t think those Custom Headers are on the WhiteList inPowerQuery Option 2: the REST endpoint doesn't return error codes like that (SharePoint)
    – Maxcot
    Apr 20, 2021 at 1:10
  • PowerQuery? that totally changes the question. In this case, no, I don't think there is a "binary" way you can use there to determine if a list exists or not. At least I don't know how to do it. Apr 20, 2021 at 1:17
  • That's what I feared.
    – Maxcot
    Apr 20, 2021 at 1:20

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.