microsoftgraph / microsoftgraph/msgraph-sdk-python

BatchRequestItem use absolute url path instead of relative when, causing "Ressource not found" 400 error

未關閉
#1,015 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

priority:p1 type:bug
主要語言
Python
星號
630
分支
96
平均合併
15 小時 20 分鐘
30 天內合併 PR
3

描述

Describe the bug

Here is my code :

batch_requests = BatchRequestContent()
for message_id in message_ids:
  query_params = MessagesRequestBuilder.MessagesRequestBuilderGetQueryParameters(
      select=[
        'id',
        'conversationId',
        'internetMessageId',
        'subject',
        'body',
        'bodyPreview',
        'from',
        'toRecipients',
        'ccRecipients',
        'bccRecipients',
        'receivedDateTime',
        'sentDateTime',
        'internetMessageHeaders',
        'isRead',
        'isDraft',
        'importance',
        'hasAttachments',
        'categories',
      ]
    )
    request_configuration = RequestConfiguration(
      query_parameters=query_params
    )
    request = service.me.messages.by_message_id(message_id).to_get_request_information(
      request_configuration=request_configuration
    )
    request_id = str(uuid.uuid4())
    batch_request_item = BatchRequestItem(id=request_id, request_information=request)
    #   batch_request_item.url = batch_request_item.url.replace('https://graph.microsoft.com/v1.0', '')
    batch_requests.add_request(request_id=request_id, request=batch_request_item)

Without the line I've commented, it causes a 400 "Resource not found for the segment 'https:'".
I figured out the problem by looking at your code.

I guess it is not the behavior as you intended.

Expected behavior

The server answer a code HTTP 200

How to reproduce

1 - List message ids from Outlook
2 - Try to get the email content in batch

SDK Version

No response

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_

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先使用 Python 範例追蹤 BatchRequestItem 和 BatchRequestContent.add_request,接著檢查批次作業的要求 URL 是如何建構的。使用 Outlook 訊息批次重現來驗證行為,並確認提交的項目使用相對路徑,且不使用 workaround 就能收到 HTTP 200。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。