GET /drive/items/{item-id}/content?format={format} errors with Not Acceptable - 406

Gal, Ofer (Israel) 131 Reputation points

Using graph-explorer in my tenant (as general admin) I made sure there is consent for Files.ReadWrite.All

and ran:!uZmcoKTvYkurWWKXx75Vg1071ukB7H1LjNqAynv0GKBibz5RvZ7ETZ-xW4x2WG52/items/01UYEFCLGSPG6J3F6RPJEKRHPEN5574UIA/content?format={'pdf'}

I get error 406

when using /content?format=pdf I get Bad Request - 400

Same call in C# using Microsoft.Graph" Version="5.50.0"

  var stream = await _graphClient.Drives[driveItem.ParentReference.DriveId].Items[driveItem.Id].Content.GetAsync((requestConfiguration) =>
      requestConfiguration.QueryParameters.Format = "{'pdf'}";

Shows error : System.InvalidOperationException: Content type application/octet-stream does not have a factory registered to be parsed

What Am I missing? is this because my environment is for developers?


Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,124 questions
0 comments No comments
{count} votes

Accepted answer
  1. AsithwMSFT 1,420 Reputation points Microsoft Vendor

    Hello Gal Ofer,

    The correct format is indeed ../content?format=pdf. It seems there might be an issue with the Graph Explorer. However, if you try using a tool like Postman, it should work there.

0 additional answers

Sort by: Most helpful