Skip to content

ContentType specified in AttachmentItem during CreateUploadSession is not preserved; defaults to application/octet-stream #2941

@GregoryJord

Description

@GregoryJord

Describe the bug

When creating an upload session using the Microsoft Graph SDK to upload large file attachments, the ContentType set in the AttachmentItem is ignored. After the upload completes, fetching the attachment metadata always shows "application/octet-stream" as the content type, regardless of the originally specified MIME type (e.g., "image/png").

Expected behavior

The MIME type specified in the AttachmentItem.ContentType should be preserved and reflected correctly in the attachment metadata after upload. This would allow proper content type handling when serving the file to users.

How to reproduce

Create an upload session with an AttachmentItem specifying a ContentType (e.g., "image/png").

Upload the file using the session.

Fetch the uploaded attachment metadata using the Microsoft Graph SDK.

Observe that the contentType returned is "application/octet-stream" instead of the specified MIME type.

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