2

I am using rest api to get the items from a document library:

/_api/web/lists/GetByTitle('${listName}')/items?${queryString}

However none of the returning properties is a thumbnail image of the document.

I came across the idea of using getpreview.ashx - with passing in the path to the file - but for some reason this just picks out a random image from each document - I was expecting the front page to be returned (much like the standard document view in SPO)

can anyone help?

1

This will return the url of the thumbnail -->

/_api/web/lists/getbytitle('title')/items(itemid)?$select=EncodedAbsThumbnailUrl

To retrieve the content -->

/_api/web/getfilebyserverrelativeurl('url of the thumbnail')/$value

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbuiltinfieldid.encodedabsthumbnailurl.aspx

  • I may be getting confused but if I try to run it against my Documents library - this is returned as a response - The field or property 'EncodedAbsThumbnailUrl' does not exist. is there a setting I need to enable somewhere? Just to be clear this is SharePoint Online – Jason May 22 '18 at 15:42
  • Hi, only thing that comes to mind is that you may need to tweek the managed properties, maybe it is not being returned because it is not being mapped. maybe these links help: support.office.com/en-us/article/… and c-sharpcorner.com/UploadFile/93cb27/… – Jaime Arroyo Garcia May 23 '18 at 16:10

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.