PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteFor a static image in a SharePoint Online file card or list, request the item’s thumbnail through the Microsoft Graph thumbnails endpoint. For an interactive document preview, use Graph’s separate preview action. Neither operation guarantees a result for every file: an item can have no thumbnail, and preview support depends on the file, service, tenant policy and client experience.
Choose a thumbnail or an interactive preview
A thumbnail is a compact image that represents a file in a card, tile or list. Graph returns thumbnail metadata and, when available, an image URL or content route. An interactive preview is different: it lets a person view the document in a browser experience. It is not a static image, and its temporary embed URL is tied to the identity that requested it.
| What you need | Graph operation | What it returns | Important constraint |
|---|---|---|---|
| A static image for a file card or list | GET /drives/{drive-id}/items/{item-id}/thumbnails |
ThumbnailSet metadata, which can include image sizes and URLs | An item can have zero or more thumbnail sets; available sizes can vary. |
| An actual file preview | POST /drives/{driveId}/items/{itemId}/preview |
Potentially a temporary GET URL or POST URL and parameters for embedding | The URL is short-lived and caller-scoped. |
| A PDF rendition of a supported source file | GET /drive/items/{item-id}/content?format=pdf |
Converted PDF content | Conversion is a distinct operation with a limited supported-source list, not the usual thumbnail route. |
This guide focuses on SharePoint Online through Microsoft Graph v1.0. The Graph thumbnail reference says thumbnails are not supported on SharePoint Server 2016; that statement does not establish behavior for every SharePoint Server release.
Before making the request
Identify the drive and item
Graph needs the SharePoint drive ID and the file’s item ID. These are not necessarily the human-readable site URL, library name or filename. Obtain the identifiers through the Graph route your application already uses to locate the library and file. The thumbnail operation supports drive-based requests and documented equivalent routes for sites, groups, users and the signed-in user’s drive.
#1 Best Overall
Request an access token with least privilege
For work or school delegated access, Microsoft lists Files.Read as the least-privileged permission for both thumbnail retrieval and preview. For application access, the listed least-privileged permission is Files.Read.All. SharePoint Embedded has separate container requirements, including FileStorageContainer.Selected and relevant container-type permissions; do not treat those Embedded requirements as prerequisites for every SharePoint Online Graph request.
Obtain the token using your application’s configured Microsoft identity platform flow. The examples below expect an already-issued bearer token in an environment variable; they do not implement sign-in or token acquisition. Keep the token secret and do not put it in a public page or source repository.
Retrieve a static document thumbnail
1. Request available thumbnail sets
Use the item’s drive and item IDs in this v1.0 route:
GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/thumbnails
Authorization: Bearer {token}
The response contains a value array of thumbnail sets. A set can expose size objects such as small, medium and large, with dimensions and a URL. Treat each size as optional: check what the response actually contains rather than assuming that every set has every size.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
2. Select a size and use its returned URL
Choose an available size suitable for your UI and read its returned URL. The URL can change when a file change requires a new thumbnail, so do not store it as a permanent identifier. If you need the image content through Graph, the documented route is /thumbnails/{thumb-id}/{size}/content; that route redirects to the thumbnail URL. Follow the redirect in a server-side client when downloading the image.
3. Use a custom size when the standard options do not fit
The API reference documents custom size identifiers. For example, c300x400 fits the image within a 300-by-400 box while preserving the source aspect ratio; c300x400_crop fills and crops to that box. These are sizing instructions, not a guarantee that the returned image file will have exactly those pixel dimensions. Inspect the actual response and render it with appropriate image sizing in your interface.
4. Avoid one thumbnail request per row when listing files
For a file listing, Graph documents expanding thumbnails alongside DriveItems, for example with $expand=thumbnails, so an application can request item and thumbnail metadata together rather than issuing a separate thumbnail request for every visible file. Follow the documented listing pattern for the particular route you use: some nested expand forms do not work. If a listing response omits thumbnail data, use the documented per-item thumbnail route rather than assuming that every combination of expansions is supported.
Runnable examples for the thumbnail endpoint
Set GRAPH_TOKEN, DRIVE_ID and ITEM_ID to values for a file the calling identity can read. The examples request the thumbnail collection, select the first available size from medium, small or large, and download its returned URL. They fail clearly if Graph returns no usable thumbnail instead of silently claiming that a file has one.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #3
cURL
export GRAPH_TOKEN='YOUR_GRAPH_ACCESS_TOKEN'
export DRIVE_ID='YOUR_DRIVE_ID'
export ITEM_ID='YOUR_ITEM_ID'
curl --fail-with-body
-H "Authorization: Bearer $GRAPH_TOKEN"
"https://graph.microsoft.com/v1.0/drives/$DRIVE_ID/items/$ITEM_ID/thumbnails"
-o thumbnails.json
python -c 'import json; d=json.load(open("thumbnails.json")); print(json.dumps(d, indent=2))'
After inspecting the JSON, download a selected returned URL with a redirect-following HTTP client. Do not substitute a guessed URL for the one Graph returned.
Python
import os
import requests
base = "https://graph.microsoft.com/v1.0"
headers = {"Authorization": f"Bearer {os.environ['GRAPH_TOKEN']}"}
drive_id = os.environ["DRIVE_ID"]
item_id = os.environ["ITEM_ID"]
response = requests.get(
f"{base}/drives/{drive_id}/items/{item_id}/thumbnails",
headers=headers,
timeout=30,
)
response.raise_for_status()
sets = response.json().get("value", [])
sizes = ("medium", "small", "large")
selected = next(
(thumb.get(size) for thumb in sets for size in sizes
if thumb.get(size) and thumb[size].get("url")),
None,
)
if selected is None:
raise RuntimeError("Graph returned no usable thumbnail size for this item")
image = requests.get(selected["url"], timeout=30)
image.raise_for_status()
with open("thumbnail", "wb") as output:
output.write(image.content)
print(f"Saved thumbnail ({selected.get('width')} x {selected.get('height')})")
The returned image URL is used as received. If you instead call the Graph .../thumbnails/{thumb-id}/{size}/content route, use the identifiers and size from the response and allow the HTTP client to follow its redirect.
Node.js
const base = 'https://graph.microsoft.com/v1.0';
const token = process.env.GRAPH_TOKEN;
const driveId = process.env.DRIVE_ID;
const itemId = process.env.ITEM_ID;
if (!token || !driveId || !itemId) throw new Error('Set GRAPH_TOKEN, DRIVE_ID and ITEM_ID');
const response = await fetch(
`${base}/drives/${encodeURIComponent(driveId)}/items/${encodeURIComponent(itemId)}/thumbnails`,
{ headers: { Authorization: `Bearer ${token}` } }
);
if (!response.ok) throw new Error(`Graph returned ${response.status}: ${await response.text()}`);
const data = await response.json();
const sizes = ['medium', 'small', 'large'];
let selected;
for (const set of data.value ?? []) {
selected = sizes.map(size => set[size]).find(size => size?.url);
if (selected) break;
}
if (!selected) throw new Error('Graph returned no usable thumbnail size for this item');
const image = await fetch(selected.url);
if (!image.ok) throw new Error(`Thumbnail download returned ${image.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('thumbnail', Buffer.from(await image.arrayBuffer()));
console.log(`Saved thumbnail (${selected.width ?? '?'} x ${selected.height ?? '?'})`);
These examples demonstrate retrieval after token acquisition, not an entire identity configuration. Use your organization’s supported OAuth flow, renew access tokens when they expire and avoid logging bearer tokens or temporary image URLs.
Request an interactive preview instead
When the user needs to read or interact with the document rather than see a small image, call POST /drives/{driveId}/items/{itemId}/preview. The response may include getUrl, postUrl and postParameters. Which fields appear depends on embed support and requested options. Optional page and zoom values apply only when the relevant preview application supports them.
Rank #4
POST https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/preview
Authorization: Bearer {token}
Content-Type: application/json
{}
For example, a minimal server-side request in Python is:
import os
import requests
url = (
"https://graph.microsoft.com/v1.0/drives/"
f"{os.environ['DRIVE_ID']}/items/{os.environ['ITEM_ID']}/preview"
)
r = requests.post(
url,
headers={
"Authorization": f"Bearer {os.environ['GRAPH_TOKEN']}",
"Content-Type": "application/json",
},
json={},
timeout=30,
)
r.raise_for_status()
preview = r.json()
print(preview)
If Graph returns a GET URL, the documented flow can use it in an iframe or open it in a browser page. If it returns a POST URL and parameters, submit those parameters as a form POST according to the response. Do not assume a GET URL will always be present.
Protect preview URLs and the permission boundary
Microsoft describes preview URLs as temporary, intended for the caller’s own use and not to be shared. A visitor using a URL acts with the calling identity’s permissions. Do not treat the URL as a durable, independently permissioned share link, publish it in a public page, or store it as a long-lived document identifier. For a server application with broader access than the intended viewer, keep the preview flow behind an authorization boundary; Microsoft recommends precautions such as using a read-only application identity and restricting access to page internals.
Delegated personal Microsoft account access is not supported for the documented preview endpoint. The preview documentation covers SharePoint and OneDrive for Business; keep the actual product and identity type in view when choosing the route.
Recommended Free Tools
Best Value
When PDF conversion is relevant
Graph also documents conversion of supported source formats through GET /drive/items/{item-id}/content?format=pdf. This returns converted PDF content; it is not the thumbnail collection and should not be added as a routine prerequisite for files whose thumbnails are already available. The supported input extensions are limited, so check the current Graph conversion reference for the format you need before designing a conversion-dependent workflow.
Troubleshoot missing thumbnails and failed previews
- The thumbnail collection is empty or lacks the expected size: a DriveItem can have zero or more thumbnail sets, and individual size objects are optional. Check the full returned
valuearray, try another returned size, and provide a file-type icon or an open-file link as an application fallback. - The request returns an authorization error: confirm that the token is valid for Microsoft Graph, the caller can read the file, and the app has the appropriate delegated or application permission and consent. For SharePoint Embedded, also verify the applicable container permissions.
- The request targets the wrong item: verify that the drive and item IDs refer to the intended SharePoint Online file. A filename alone is not a substitute for the Graph identifiers required by the route.
- The preview action fails for a particular file: check the identity type, access rights, file type, tenant policy and service capability. Microsoft advises handling preview failures gracefully; use a supported alternative experience, such as opening the document, rather than making preview success a requirement for the whole listing.
- A stored image URL stops working: thumbnail URLs can change when the item changes. Request current thumbnail metadata again rather than treating an earlier URL as permanent.
- A custom-size image looks different from the requested box: the sizing option describes fit or crop behavior, not a guaranteed exact output dimension. Check returned dimensions and adjust the UI’s display behavior.
- A PDF conversion request does not work: conversion applies only to supported source extensions. It is separate from thumbnail retrieval; check format support and avoid routing ordinary thumbnail requests through conversion without a specific need.
File-type support is not universal. Microsoft states: “File type support can vary by service capability, tenant policy, and client experience. Always handle preview failures gracefully.” — Microsoft Learn, “Preview files in your app.” Do not publish an exhaustive format list without checking the current support documentation for the formats and tenant involved.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server, not a Microsoft Graph SharePoint document-thumbnail endpoint. Use Graph above for SharePoint files. If the thing you need is a screenshot of a webpage, ScreenshotNeo provides a one-request route instead of a browser setup. Its clean-shot flow accepts cookie or consent banners as a visitor and removes 60+ known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits cost nothing, and responses identify the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info and capture_pdf.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Learn about ScreenshotNeo, then sign up free for 1,000 screenshots a month with no card.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

