且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过 REST API 检索页面上的图像 url

更新时间:2023-12-03 08:23:46

似乎无法直接使用 SharePoint REST 检索 Publishing Image 字段,请参阅 这篇文章 了解更多信息.

It does not seem possible to retrieve Publishing Image fields using SharePoint REST directly, refer this post for an additional information.

有一种解决方法,可以使用对 /_api/web/lists/getbytitle('Pages')/items()/FieldValuesAsHtml 端点的单独请求来检索发布字段.

There is a workaround, publishing fields could be retrieved using a separate request to /_api/web/lists/getbytitle('Pages')/items(<item id>)/FieldValuesAsHtml endpoint.

以下示例演示了如何从文章页面检索 PublishingPageImage 属性:

The following example demonstrates how to retrieve PublishingPageImage property from an article page:

/_api/web/lists/getbytitle('Pages')/items(<item id>)/FieldValuesAsHtml?$select=PublishingPageImage

如果您对 JavaScript 解决方案感兴趣,请查看这个答案.

If you are interested in JavaScript solution, please check this answer.