Setting additional_data for DriveItemUploadableProperties throw 400
まだ誰も着手していません。
評価
調査の方向性
create_upload_session エントリポイントから始め、DriveItemUploadableProperties と CreateUploadSessionPostRequestBody が追加データを additional_data にどのようにシリアライズするかを調査します。msgraph.generated.models.drive_item_uploadable_properties と @microsoft.graph.conflictBehavior フィールドを使って、Issue のリクエストを再現します。createUploadSession がドキュメントに記載されたフィールドを受け付け、ファイルがすでに存在する場合に要求された競合動作を適用すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When try to add any field from the docs, such as "description" or "@microsoft.graph.conflictBehavior" to DriveItemUploadableProperties from msgraph.generated.models.drive_item_uploadable_properties msgraph throw this:
E msgraph.generated.models.o_data_errors.o_data_error.ODataError:
E APIError
E Code: 400
E message: None
E error: MainError(additional_data={}, code='invalidRequest', details=None, inner_error=InnerError(additional_data={}, client_request_id='463c4945-0f9c-435e-9ece-30e48ff358b6', date=DateTime(2024, 11, 6, 8, 37, 41, tzinfo=Timezone('UTC')), odata_type=None, request_id='48083d5b-ecd3-4176-8447-112ab2233e72'), message='The request is malformed or incorrect.', target=None)
code i used for this:
sp_url = f'{self.drive_path}/items/root:{remote_path}:'
sp_session_url = sp_url + '/createUploadSession'
base_request_builder = (
self.client.drives.by_drive_id(self.drive_id)
.items.by_drive_item_id("root").create_upload_session.with_url(
sp_session_url,
)
)
create_session_response = await base_request_builder.post(
CreateUploadSessionPostRequestBody(
item=DriveItemUploadableProperties(
name=file_name,
additional_data={
"@microsoft.graph.conflictBehavior": "rename",
},
),
)
)
I also tried to add additional_data to CreateUploadSessionPostRequestBody but it does nothing
Expected behavior
When uploading file to Sharepoint and file with the same name already exists it must add suffix (1) or _1 to the new file
How to reproduce
try to upload file with createUploadSession if file with that name already exists using code above
SDK Version
1.9.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分
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
status:waiting-for-triage
難易度 5/5 1週間以上 初心者へのやさしさ 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 件 ·
microsoftgraph/msgraph-sdk-python の issue をすべて見る
似ている issue
-
fix: inaccuracy ⚠️
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
uabrc/uabrc.github.io#1255 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
ethereum-optimism/factory#64 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
duckdb/duckdb-python#627 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
Qiskit/qiskit-addon-sqd#376 ·