0

I can currently display thumbnail of documents using rest api by using the ServerRedirectedEmbedUri-

_api/web/lists/getbytitle('Documents')/items?select=id,Title,EncodedAbsUrl,EncodedAbsThumbnailUrl,EncodedAbsWebImgUrl,FileLeafRef

But i also have images e.g png files stored in the library. But for the images files the rest api returns null for ServerRedirectedEmbedUri

Any ideas how i can get the thumbnail for images e.g png .

I can use getpreview.ashx

But would like to use the same query for both. Is it possible?

3
  • What's the column name of the image column?ServerRedirectedEmbedUri? – Amos Oct 27 '20 at 6:30
  • Thanks Amos. But not sure what you mean? The image was uploaded just as the documents were uploaded – naijacoder Oct 29 '20 at 5:36
  • I mistakenly thought you were using the new column type Image in SharePoint Online. – Amos Oct 29 '20 at 5:55
1

You may have a try below methods:

  • getpreview.ashx. This is recommended as i find that Delve uses this solution to get thumbnails

https://abc.sharepoint.com/sites/s01/_layouts/15/getpreview.ashx?path=https://abc.sharepoint.com/sites/s01/Shared Documents/4215097.png

  • SP.Publishing.EmbedService/EmbedData

https://abc.sharepoint.com/sites/s01/_api/SP.Publishing.EmbedService/EmbedData?url='https://abc.sharepoint.com/sites/s01/Shared Documents/4215097.png'&version=1

  • MS Graph API or SharePoint Rest API V2

https://docs.microsoft.com/en-us/graph/api/driveitem-list-thumbnails?view=graph-rest-1.0&tabs=http

https://docs.microsoft.com/en-us/sharepoint/dev/apis/sharepoint-rest-graph

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.