microsoftgraph / microsoftgraph/msgraph-sdk-python
A list item field with value 'PT' being converted to Datetime object
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 630
- 派生
- 96
- 平均合并
- 15 小时 20 分钟
- 30 天内合并 PR
- 3
描述
Describe the bug
I am trying to iterate through a SharePoint list entries/rows for further processing:
...
list = await client.sites.by_site_id(site_id).lists.by_list_id(list_id).items.get(request_configuration=request_config)
rows = []
for item_id in list.value:
fields = item_id['fields']
rows.append(fields.additional_data.get("code")) # test
rows
but when text/string field have value 'PT' it is retrieved as a datetime (exactly: "datetime.timedelta(0)"). It makes my code useless for keeping for example 'Country Code' as list's field. I have seen similar issue before with 4-digit strings, so maybe it is related.
Please, take a moment to look at this.
here some screenshots:
list in SP (just field 'code' and its values) :
and my code results:
Expected behavior
Expected behavior would be to display 'code' the same way as it is in SharePoint list, means:
PT
PTA
..
How to reproduce
To reproduce please just create new list with text field. Then add value 'PT' to this field and try to use await client.sites.by_site_id(site_id).lists.by_list_id(list_id).items.get(request_configuration=request_config) for entried reading.
SDK Version
1.40.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_
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 await ...items.get(...) 使用的 Python SDK 路径开始,跟踪 SharePoint 列表字段值的反序列化过程。使用包含 "PT" 的文本字段复现该情况,并添加一个针对性的回归测试;当该值仍为字符串 "PT",而不是变成 datetime.timedelta(0) 时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100