Skip to content

Graph.Drive.Item.Content returns null if the file is empty #2839

@catmanjan

Description

@catmanjan

Describe the bug

Graph.Drive.Item.Content is to be used to return a stream of the file content, however if the file is empty it returns null - this is unexpected because an empty file (stream with length zero) is different from null - happy to be directed to any doco which contradicts this for Graph purposes.

Expected behavior

Should return a stream with length zero

How to reproduce

Upload an empty file and try to download its contents using code like this:

            var content = await graphClient
                .Drives["b!C6YVIzpT60SYqdpHCYpAZXQj2FA-LzVJhxb5VG0bjuh5Q7qKO0dqTpssSrUI12kI"]
                .Items["01ACRBDKP5P323XRKICFA2XSPOZVLGJFSW"]
                .Content
                .GetAsync();

content is null

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions