Thumbnails for pages in SharePoint Online are generated using the getpreview handler. Using this handler predefined image formats can be used using the ‘resolution’ URL parameter. When this parameter isn’t specified resolution 0 is used: fixed width of 300px.
Besides the resolution parameter two different sets of URL parameters can be used to get the images of the page.
The path parameter expects the path of the file to generate the thumbnail for.
To generate a thumbnail the full URL should look like this:
Or the thumbnail can be retrieved from another location eg the root
The guid parameters are actually three parameters.
guidSite – the guid of the site collection without the curly brackets
guidWeb – the guid of the web without the curly brackets
guidFile – the guid of the file
Or it can be retrieved from another location eg the root
Recently an issue arose in which no thumbnails were displayed on a page.
After some investigation it seemed that special characters in the URL of the page are preventing SharePoint from finding the thumbnail when using the path parameter.
Creating a page using the UI providing the title ‘België’ results in a URL of belgië.aspx.
Once an image is added to the page or the thumbnail of the page is set manually, a folder is generated in the Site Assets library to store the image. When a special character is used like in the name België the folder name gets encoded to ‘BelgC3AB’.
As long as the preview handler is used to get the thumbnail within the site the page is stored, the path parameter is working just fine and as expected, but when this thumbnail will be approached from another site it can’t be found and an error (404 Not found) is thrown.
Usage within the site the page is stored results in the preview of the thumbnail:
Approach from another site eg the root results in a 404 Not found:
To be sure the getpreview handler can generate the thumbnails of a file at all times use the guid parameters instead of the path parameter.