1

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

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

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.

0

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.

1
  • 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 '21 at 3:04

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.