How to know what file types are supported to generate previews on Office 365 ?

In our previous articles (here and here) we have seen how to generate a preview for a document stored in SharePoint / Office 365.

When you develop applications around Office 365 and because you can store potentially (there are some exceptions) any types of documents in a SharePoint site, it could be interested to know what file types are supported to generate a preview for those documents.

There’s no official documentation on how to achieve this operation but you have to know that it’s possible using the same handler as that described in our previous articles (GetPreview.ashx).

Indeed, that handler has some hidden features and one of them is the ability to get supported file types. To do that, you just have to call the following URL (don’t forget to pass a valid authentication token in HTTP headers, as you do with REST APIs) :

https://<tenant>.sharepoint.com/_layouts/15/GetPreview.ashx?Action=supportedtypes

When you call that URL, the server return a JSON response such as the following :

{
  "DocumentTypes":[
    {"Always":false,"FileExtension":".wmv","MultiPreview":false},
    {"Always":false,"FileExtension":".3gp","MultiPreview":false},
    {"Always":false,"FileExtension":".3g2","MultiPreview":false},
    {"Always":false,"FileExtension":".3gp2","MultiPreview":false},
    {"Always":false,"FileExtension":".asf","MultiPreview":false},
    {"Always":false,"FileExtension":".mts","MultiPreview":false},
    {"Always":false,"FileExtension":".m2ts","MultiPreview":false},
    {"Always":false,"FileExtension":".avi","MultiPreview":false},
    {"Always":false,"FileExtension":".mod","MultiPreview":false},
    {"Always":false,"FileExtension":".dv","MultiPreview":false},
    {"Always":false,"FileExtension":".ts","MultiPreview":false},
    {"Always":false,"FileExtension":".vob","MultiPreview":false},
    {"Always":false,"FileExtension":".xesc","MultiPreview":false},
    {"Always":false,"FileExtension":".mp4","MultiPreview":false},
    {"Always":false,"FileExtension":".mpeg","MultiPreview":false},
    {"Always":false,"FileExtension":".mpg","MultiPreview":false},
    {"Always":false,"FileExtension":".m2v","MultiPreview":false},
    {"Always":false,"FileExtension":".ismv","MultiPreview":false},
    {"Always":false,"FileExtension":".mov","MultiPreview":false},
    {"Always":true,"FileExtension":".docm","MultiPreview":false},
    {"Always":true,"FileExtension":".docx","MultiPreview":false},
    {"Always":true,"FileExtension":".dotx","MultiPreview":false},
    {"Always":true,"FileExtension":".dotm","MultiPreview":false},
    {"Always":true,"FileExtension":".bmp","MultiPreview":false},
    {"Always":true,"FileExtension":".jpg","MultiPreview":false},
    {"Always":true,"FileExtension":".jpeg","MultiPreview":false},
    {"Always":true,"FileExtension":".tiff","MultiPreview":false},
    {"Always":true,"FileExtension":".tif","MultiPreview":false},
    {"Always":true,"FileExtension":".png","MultiPreview":false},
    {"Always":true,"FileExtension":".gif","MultiPreview":false},
    {"Always":true,"FileExtension":".emf","MultiPreview":false},
    {"Always":true,"FileExtension":".wmf","MultiPreview":false},
    {"Always":false,"FileExtension":".pdf","MultiPreview":false},
    {"Always":true,"FileExtension":".pptm","MultiPreview":true},
    {"Always":true,"FileExtension":".pptx","MultiPreview":true},
    {"Always":true,"FileExtension":".potm","MultiPreview":true},
    {"Always":true,"FileExtension":".potx","MultiPreview":true},
    {"Always":true,"FileExtension":".ppsm","MultiPreview":true},
    {"Always":true,"FileExtension":".ppsx","MultiPreview":true},
    {"Always":false,"FileExtension":".xlsm","MultiPreview":false},
    {"Always":false,"FileExtension":".xlsx","MultiPreview":false}
  ]
}

You get an array of document types and for each item, you are able to know :

  • FileExtension => Does it really need to be explained ? 😉
  • Always => Does the handler is always able to generate a preview or can it fail (e.g. because the file contains unsupported features)
  • MultiPreview => Does the handler is able to generate multiple previews for the same document (e.g. slides on PowerPoint presentations)

As you can see, there’s only a few document types that are supported by Office 365 to generate previews. Now you can improve your applications to not try to generate previews for unsupported types 😉

Advertisements

One thought on “How to know what file types are supported to generate previews on Office 365 ?

  1. Pingback: SharePoint & Office 365: Recopilatorio de enlaces interesantes (III)! - Blog de Juan Carlos González en Geeks.MS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s