我正在使用 Microsoft Graph 资源管理器在 Sharepoint 中搜索 PPTX 文件:
https://graph.microsoft.com/v1.0/sites/MYSITE.sharepoint.com/drive/root/search(q = 'term AND .pptx')?$expand=thumbnails
这可以正常工作并返回包括缩略图网址的结果,例如:
"value": [
{
[...],
"thumbnails": [
{
"id": "0",
"large": {
"height": 800,
"url": "https://westeurope1-mediap.svc.ms/transform/thumbnail?provider=spo&inputFormat=pptx&cs=ZGU4YmM4YjUtZDlmOS00OGIxLWE4YWQtYjc0OGRhNzI1MDY0fFNQTw&docid=https%3A%2F%2Fveodin2%2Esharepoint%2Ecom%2F%5Fapi%2Fv2%2E0%2Fdrives%2Fb%21ZZLBnC7JSUiDFsO07HLwwZiU%5F3PZL3hOreOxO%2D7%2D6OUVoo3IebmnSLCtR%5FGar3MR%2Fitems%2F01D33FTF2VJGLOTD3PG5HJEJTWDA5HQN4T%3Faccess%5Ftoken%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9%2EeyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvdmVvZGluMi5zaGFyZXBvaW50LmNvbUA5ZmY0MTY2Yy02ZDBlLTQxNmItODg1ZC1kZmI4YTZkYWZmNTEiLCJpc3MiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAiLCJuYmYiOjE1OTk4MjY4MjMsImV4cCI6MTU5OTgzNzYyMywiZW5kcG9pbnR1cmwiOiJBcHdkcDFVN1VPQkdPbGk2TWtYUmdYdVk0alFkeStYSjVsRUVqZThRZm1RPSIsImVuZHBvaW50dXJsTGVuZ3RoIjoiMTU1IiwiaXNsb29wYmFjayI6IlRydWUiLCJhcHBpZCI6ImRlOGJjOGI1LWQ5ZjktNDhiMS1hOGFkLWI3NDhkYTcyNTA2NCIsInRpZCI6IjlmZjQxNjZjLTZkMGUtNDE2Yi04ODVkLWRmYjhhNmRhZmY1MSIsInVwbiI6ImptZW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ZEp6M2c9PSIsImlzdXNlciI6InRydWUifQ%2EpHVBmvjFcARCcygYv4ll6zuayGQRDChsHI7%5FNSEic%5F0U8PB9mmrIqE2cw%5FlNLKxVQ0pLlbV%2Dx64K6SlxwC1jSRzUNlsEAuEdMKNxlnKVND81OZoGYFMm3vMjHnFmXXIrv7CRc93NeFcByYwU%2DnqHg%2D2ETvyaUmdQjqdoBXtCVo80Jybj0Tek3f8qnz%2DncexDzAks6nBlgjhEqRi9hTBPWblnhvDZVoeQYb26MCU2pwyhWRe3ziH6M4WuEqT4NaOU9v3UNtK87rG%5Ffg%2DL5DVbWlYb2vywt1jNKFYs535WPHAFOS7h3ior4qHP471xTr4s%5Frgu1%2Dz0o0Ep9S%2DZXaj5kw%26version%3DPublished&width=800&height=800&cb=63627410891",
"width": 800
},
[...]
}
]
}
]
}
但是返回的 URL 不起作用,但会引发错误:
{"error":{
"code": "generalException",
"message": "Error from Office Service. Url=https://pptcs.officeapps.live.com/document/export/thumbnail HttpCode=NotFound cert=subject:;thumbprint: ResponseHeaders=Connection: close\r\nDate: Fri, 11 Sep 2020 12:25:31 GMT\r\nServer: Microsoft-IIS/10.0\r\nX-Powered-By: ASP.NET\r\n",
"innererror": {
"code": "OfficeConversion_ConverterInternal"
}
}}
它适用于 PDF。
还显式查询缩略图 URL(在搜索项目 ID 之后)的工作方式类似于 `https://graph.microsoft.com/v1.0/sites/MYSITE.sharepoint.com/drive/items/{item-id}/缩略图