Get resource

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Retrieve the binary data of a file or image resource object.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Notes.Read, Notes.ReadWrite, Notes.Read.All, Notes.ReadWrite.All
Delegated (personal Microsoft account) Notes.Read, Notes.ReadWrite
Application Notes.Read.All, Notes.ReadWrite.All

HTTP request

GET /me/onenote/resources/{id}/content
GET /users/{id | userPrincipalName}/onenote/resources/{id}/content
GET /groups/{id}/onenote/resources/{id}/content
GET /sites/{id}/onenote/resources/{id}/content

Request headers

Name Type Description
Authorization string Bearer {token}. Required.

Request body

Do not supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and the image or file binary data in the response body.

Note: Images won't render directly in a browser because they require authorization to retrieve them, like the rest of the page content.

Example

Request

Here is an example of the request.

GET https://graph.microsoft.com/beta/me/onenote/resources/{id}/content
Response

Here is an example of the response.

HTTP/1.1 200 OK
Content-Type: application/octet-stream

...binary data...

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var resources = await graphClient.Me.Onenote.Resources["{id}"]
	.Request()
	.Select( e => new {
			 e.Content 
			 })
	.GetAsync();

var content = resources.Content;

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.