2

I'm looking into options for retrieving thumbnails from SharePoint Online for an external .NET application using the SharePoint client object model (CSOM).

I've seen the following suggestion which apparently works for many files types (Word, Excel, PowerPoint, MP4), but I am experiencing many instances where it isn't working, even for images.

https://tenant.sharepoint.com/portals/hub/_layouts/15/getpreview.ashx?path=https%3A%2F%2Ftenant.sharepoint.com%2Fportals%2Fcommunity%2FpVid%2FBiking%2520to%2520Work.mp4

Could anyone explain why the above URL isn't working for various file types? Is it something to do with how the library has been setup? The content type?

Another option I've come across when browsing a SharePoint library and changing the view mode to Tiles is that the thumbnails come from another URL

https://centralus1-mediap.svc.ms/transform/thumbnail?provider=...&inputFormat=...&cs=...&docid=...&access_token=...&width=...&height=...&srcWidth=...&srcHeight=...&cropMode=...

I've not found any documentation for this URL. Has anyone come across this URL before? Is it possible to access from an external application?

0

The /_layouts/15/getpreview.ashx works in my test, check the screenshot below: enter image description here

The Url like this:

https://xx.sharepoint.com/sites/team/_layouts/15/getpreview.ashx?path=https://xxx.sharepoint.com/sites/team/doc1/Document.docx

More information: https://blog.beecomedigital.com/2015/07/27/generate-thumbnail-of-a-document-stored-in-sharepoint-from-its-url/

  • That is the link I have been using but with inconsistent results. It doesn't always work for images and doesn't work for videos. – Sean Dooley Jan 3 '18 at 10:18
  • Managed to get the it working for all image file types. Still no look with getting video thumbnails resulting in a 501 error. – Sean Dooley Feb 2 '18 at 13:45
  • @SeanDooley did you found solution for video files? – Joao Paulo Sep 18 '18 at 16:05
  • @JoaoPaulo I never found a solution for the video files. – Sean Dooley Sep 19 '18 at 19:21
0

The following works for files stored in SharePoint Online document libraries using the Graph API to retrieve the thumbnail URLs:

  1. Open the Microsoft Graph Explorer site to check your REST call syntax.
  2. Call https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/anothersitecollection:/drives to get the document libraries as drives and save the ID of the document library you need. Substitute your SharePoint tenant for "contoso" and your site collection URL component for "anothersitecollection".

  3. Call https://graph.microsoft.com/v1.0/drives/b!aXYZmss8ZEiVokyC-JytN274MKTABCdAqaqixLW2-0JqtL9COCftQr9Ct9neeDKJ/root/children to get the documents in the document library. Substitute your long drive ID for the example.

  4. Call https://graph.microsoft.com/v1.0/drives/b!aXYZmss8ZEiVokyC-JytN274MKTABCdAqaqixLW2-0JqtL9COCftQr9Ct9neeDKJ/items/01EQBDECC66F3P3O5YI5ABCIGG7O6M4Q23/thumbnails to get the thumbnail URLs. Substitute your long document ID for the example.

From my blog post: http://blog.larslynch.com/2019/01/3d-and-other-thumbnails-in-sharepoint.html

  • Thanks for the information @Lars. I will try and give that a go next week. – Sean Dooley Jan 11 at 22:40

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.