Error 400 during put on drive item
@PrzemyslawSagalo 已经在做这个了。
开始于 2024年6月3日。
评估
这个 Issue 还没有评估数据。
描述
Describe the bug
I am trying to upload a .docx file into OneDrive using Graph API. Unfortunately, it returns an error 400.
msgraph.generated.models.o_data_errors.o_data_error.ODataError:
{
APIError
Code: 400
error: MainError(code='BadRequest', message='Entity only allows writes with JSON Content-Type header.')
}
Expected behavior
Based on the type from the code of the sdk passed type is correct, so I don't understand this behaviour and the bellow code should upload the file.
How to reproduce
file_path = "test.docx"
with open(file_path, "rb") as file_handle:
file_bytes = file_handle.read()
item_path = "/root:/Documents/test_on_one_drive.docx"
r = await client.drives.by_drive_id(drive_id).items.by_drive_item_id(item_path).content.put(body=file_bytes)
SDK Version
1.4.0
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_
- 主要语言
- Python
- 星标
- 630
- 派生
- 96
- 平均合并
- 15 小时 20 分钟
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoftgraph/msgraph-sdk-python 的其他 Issue
-
status:waiting-for-triage type:bug
难度 1/5 1 小时以内 新手友好度 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
-
status:waiting-for-triage type:bug
难度 2/5 1-3 小时 新手友好度 75/100
microsoftgraph/msgraph-sdk-python#1563 ·
-
Needs: Attention :wave: type:bug
难度 2/5 1-3 小时 新手友好度 62/100
microsoftgraph/msgraph-sdk-python#1287 · 2 条评论 · 1 个 reaction ·
-
status:waiting-for-triage
难度 5/5 一周以上 新手友好度 25/100
microsoftgraph/msgraph-sdk-python#1557 ·
-
status:waiting-for-triage type:bug
难度 3/5 1-2 天 新手友好度 55/100
microsoftgraph/msgraph-sdk-python#1556 · 1 条评论 · 1 个 reaction ·
查看 microsoftgraph/msgraph-sdk-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 86/100
-
🐛 Bug 🔔 Pending processing
难度 2/5 1-3 小时 新手友好度 84/100
jumpserver/jumpserver#17584 ·