OneNoteResource 资源类型OneNoteResource resource type

OneNote 页面上的图像或其他文件资源。An image or other file resource on a OneNote page.

您可以获取资源的二进制数据, 但不支持获取资源对象或资源集合的 JSON 表示形式。You can get the binary data of a resource, but getting a JSON representation of a resource object or a resource collection is not supported.

{
  "content": { "@odata.type": "Edm.Stream" },
  "contentUrl": "string (url)"
}

通过向资源的content终结点发送 get 请求获取特定资源的二进制数据:Get the binary data of a specific resource by sending a GET request to the resource's content endpoint:

GET ../onenote/resources/{id}/content

当您使用以下请求获取页面的 HTML 内容时, 将返回文件的资源 URI:The file's resource URI is returned when you get a page's HTML content using the following request:

GET ../onenote/pages/{id}/content

在页面 HTML 中, img标记包含data-fullres-src属性中的原始图像资源和src属性中优化的图像的终结点:In the page HTML, an img tag includes endpoints for the original image resource in the data-fullres-src attribute and the optimized image in the src attribute:

<img 
    src="image-resource-url"  
    data-src-type="media-type"
    data-fullres-src="image-resource-url"  
    data-fullres-src-type="media-type" ... />

object标记 (表示 PDF、.DOCX 和 PNG 等文件) 包含data属性中的文件资源的终结点:An object tag (which represents files such as PDF, DOCX, and PNG) includes the endpoint for the file resource in the data attribute:

<object
    data="file-resource-url"
    data-attachment="file-name.file-type" 
    type="media-type" ... />

属性Properties

属性Property 类型Type 说明Description
contentcontent Stream 内容流The content stream
contentUrlcontentUrl String (url)String (url) 用于下载内容的 URLThe URL for downloading the content

关系Relationships

无。None.

方法Methods

方法Method 返回类型Return Type 说明Description
获取资源二进制数据Get resource binary data Stream 检索文件或图像资源的二进制数据。Retrieve the binary data of a file or image resource.