Skip to content

Users[userId].MailFolders[mailFolderId].Messages[messageId].Attachments.ContentBytes does not appear to be base64 encoded #2836

@catmanjan

Description

@catmanjan

Describe the bug

According to the summary comment ContentBytes is "The base64-encoded contents of the file."

However the bytes do not appear to be base64 encoded, because if I try to decode them I get an error that it is not base64 encoded

Expected behavior

Probably the comment needs to be verified

How to reproduce

var attachment = await graphClient.Users[userId].MailFolders[mailFolderId].Messages[messageId].Attachments[attachmentId]
.GetAsync() as FileAttachment;

var bytes = attachment.ContentBytes;
var base64Chars = Encoding.UTF8.GetChars(attachment.ContentBytes);
var decodedBytes = Convert.FromBase64CharArray(base64Chars, 0, base64Chars.Length);

Throws an error

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

    Labels

    area:documentationFocused on documentation of the producttype:questionAn issue that's a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions