You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileAttachment.content_bytes does not return b64-encoded content. #1556
On attempt to b64decode the content_bytes of a file attachment the following error occurs: binascii.Error: Only base64 data is allowed
The same test provided below passes with msgraph-sdk <= 1.58.0
The code comments still suggest b64-encoded content:
# The base64-encoded contents of the file.
content_bytes: Optional[bytes] = None
The <=1.58.0 boundary is misleading — this isn't an msgraph-sdk change.
It's the transitive dep: microsoft-kiota-serialization-json 1.11.6 → 1.11.7, released 2026-06-30, which changed JsonParseNode._get_bytes_value to base64-decode:
1.58.0, 1.59.2 and 1.60.0 all declare microsoft-kiota-serialization-json >=1.8.0,<2.0.0, so 1.58.0 installed fresh today picks up 1.11.7 and reproduces this. If it still works for you, something is holding kiota at <=1.11.6.
Also worth knowing it doesn't always raise. b64decode(validate=False) drops non-alphabet bytes and stops at the first =, so if the padding lands valid you get a short garbage blob back instead of an error. Our .xlsx attachments came through as ~110 bytes instead of ~9KB with no exception — only caught later when the parser said "File is not a zip file".
Workaround was dropping our own b64decode() and pinning microsoft-kiota-serialization-json>=1.11.7 directly instead of inheriting the msgraph-sdk range.
Activity
inigohidalgo commentedon Jul 22, 2026
The
<=1.58.0boundary is misleading — this isn't an msgraph-sdk change.It's the transitive dep:
microsoft-kiota-serialization-json1.11.6 → 1.11.7, released 2026-06-30, which changedJsonParseNode._get_bytes_valueto base64-decode:Deliberate — microsoft/kiota-python#646, fixing microsoft/kiota-python#636 (reader was asymmetric with
write_bytes_value).1.58.0, 1.59.2 and 1.60.0 all declare
microsoft-kiota-serialization-json >=1.8.0,<2.0.0, so 1.58.0 installed fresh today picks up 1.11.7 and reproduces this. If it still works for you, something is holding kiota at <=1.11.6.Also worth knowing it doesn't always raise.
b64decode(validate=False)drops non-alphabet bytes and stops at the first=, so if the padding lands valid you get a short garbage blob back instead of an error. Our.xlsxattachments came through as ~110 bytes instead of ~9KB with no exception — only caught later when the parser said "File is not a zip file".Workaround was dropping our own
b64decode()and pinningmicrosoft-kiota-serialization-json>=1.11.7directly instead of inheriting the msgraph-sdk range.