I have a PowerQuery function o retrieve the contents of a SharePoint list.

    Source = (url as any) => 
        aSource = OData.Feed(url, null, [Implementation="2.0"]),

But sometimes the list doesn't exist, and OData REST API calls don't seem to have a nice set of HTTP type response codes. The code bombs out with a msg

OData version 3 and 4 Error The server returned an error: (404) Not found. (List 'ABC' does not exist at site ......)

But if I paste the URL into a browser, I get a XML response, with no HTTP error codes.

1 Answer 1


Might not be the best answer, because I am not good at PowerQueries.

Perhaps, you can first filter the lists by title:

/_api/Web/Lists/?$filter=Title eq 'My List Name'

This way, if the returned array of lists contains 0 items, then your list does not exist.

If the filtered list returned 1 item - you are good to proceed to retrieve list items.

  • Yep, that is exactly what I do. but the problem is that the returned item is a "table" datatype... or the error above
    – Maxcot
    Apr 14, 2021 at 3:04

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.