One way to download a SharePoint list in TypeScript is to use the SharePoint REST API and the file-saver library. Here's an example code snippet:
index.ts895 chars31 lines
Explanation:
The code first gets the SharePoint list items using the SharePoint REST API with the $select=File
and $expand=File
query options to include the File object in the response.
It then extracts the ServerRelativeUrl
property of the File object and uses it to download the file using another fetch
request.
Finally, it converts the response into a Blob object and passes it to the saveAs
method from the file-saver library to trigger the download.
gistlibby LogSnag