Read items from a list
Reads list items from any SharePoint list when you supply ListId. For a document library, each item corresponds to a file or folder row. Turn on metadata detection below if you need extra or hidden fields (e.g. Link field in Lists, Content Type Id, etc. which are not included by default in the standard endpoint).
SELECT * FROM get_list_items
WITH (
ListId='14bdfd1d-1090-4cfe-adc1-XXXXXXXXXXXXXX'
-- Turn on Metadata Detection to get additional fields (e.g. Link to item, Content Type Id, etc.) that are not included by default in the standard endpoint. This is especially useful for document libraries.
--,MetaDetectionOrder='MergeStaticDynamic'
)
--Obtain ListId from the Lists table or list_lists (e.g. SELECT id, name FROM Lists).