microsoftgraph / microsoftgraph/msgraph-sdk-python
A list item field with value 'PT' being converted to Datetime object
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 630
- フォーク
- 96
- 平均マージ
- 15時間 20分
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
await ...items.get(...) が使用する Python SDK のパスから始め、SharePoint リストフィールドの値がどのようにデシリアライズされるかを追跡します。"PT" を含むテキストフィールドでこのケースを再現し、対象を絞ったリグレッションテストを追加します。値が datetime.timedelta(0) ではなく文字列 "PT" のままになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 50/100