microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Users[userId].MailFolders[mailFolderId].Messages[messageId].Attachments.ContentBytes does not appear to be base64 encoded
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
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_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The reproduction centers on FileAttachment.ContentBytes in the Users[userId].MailFolders[mailFolderId].Messages[messageId].Attachments[attachmentId] entry point. Start by checking the SDK/API contract and running the provided C# reproduction. Done means establishing whether ContentBytes is raw or base64 data and aligning the behavior or summary comment accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100