Forum Discussion
HTTP request to get list items while including image thumbnail links
Hi all,
In Power Automate, if you use the "Get files (properties only)" SharePoint action, the JSON response will include multiple thumbnail URLs (small, medium, large) for each file in the following format:
https://eastus1-mediap.svc.ms/transform/thumbnail?provider=spo&inputFormat=jpg&cs=N2FiNzg2MmMtNDIzFNQ&docid=https%3a%2f%2fmytenant.sharepoint.com%3a443%2f_api%2fv2.0%2fdrives%2fb!XwWFqzfnlvrVjzA9Fk%2fitems%2f01UCDPGRBBQ%3fversion%3dPublished&access_token={long-token-edited-out}&width=800&height=800
If possible, I'd like to be able to select one of those URLs while doing an API call like this:
/_api/Web/Lists/GetByTitle('big_document_library')/Items?$select=ID,FileLeafRef,{something-to-get-thumbnail?}&$top=5000
Does anyone know if this is possible or what would be the best way to get both items and their corresponding thumbnails in bulk? If possible, I'd like to avoid making separate API requests just to get the thumbnails. Thanks!
- sunilnarnawareCopper Contributor
keenan2345 were you able to get this working? I am also trying to grab viewslifetime count
- keenan2345Copper ContributorAh, unfortunately not! I ended up using the workaround described here to create thumbnail links for each file based on the file path: https://vitalyzhukov.com/en/sharepoint-online-document-thumbnail.
https://{tenant}.sharepoint.com/_layouts/15/getpreview.ashx?path={pathToTheDocument}&resolution=1