Skip to content

Get Content from drive returns None #1578

Open

Description

@finite1

Describe the bug

Trying to get the content of a sharepoint file returns None. Example code:

content = await ( client.graph_client.drives.by_drive_id(drive_id).items.by_drive_item_id(item_path).content.get() )

This has started happening a couple days ago

Expected behavior

The api call should return the content of the file

How to reproduce

execute

drive_id = drive_id
item_path = f"root:/{file_path}:"
content = await ( client.graph_client.drives.by_drive_id(drive_id).items.by_drive_item_id(item_path).content.get() )

on a relevant drive_id and item_path and check content. The function executes successfully, but content will be None.
Even though it used to work a couple days ago, using msgraph-sdk==1.62.0 did not work either.

SDK Version

1.63.0

Latest version known to work for scenario above?

1.62.0

Known Workarounds

Use requests library to get the file

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Activity

  1. added
    status:waiting-for-triage
    type:bug
    on Sep 21, 2026
  2. cfu94 commented on Nov 26, 2026

    @cfu94

    EDIT: Fixed by upgrading from msgraph-core 1.5.1 to msgraph-core 1.5.2!


    We are experiencing the same issue recently. A stock graph service client receives None when trying to get the content of a drive item. The _should_return_none function in kiota_http.httpx_request_adapter does this:

    return response.status_code == 204 or response.status_code == 304 or not bool(
                response.content
            ) or (not response.headers.get("location") and response.status_code in [301, 302])

    This returns True because for a 304 response with location header, the content is empty (which I think is valid). Removing the or not bool(response.content) fixes the issue, but I have no idea if that would break something elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triagetype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions