microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Messages.Item.SendRequestBuilder.ToPostRequestInformation() does not work in batch.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
Describe the bug
Including following post request information into batch
var sendDraftRequest = _graphClient.Me.Messages[messageId].Send.ToPostRequestInformation();
returns the following error inside batch:
{"error":{"code":"BadRequest","message":"Write request id : f4f09b02-155a-47e7-86da-a89930ad6590 does not contain Content-Type header or body.","innerError":{"date":"2024-08-19T01:08:18","request-id":"7d3af893-af46-4dc4-9dbb-c4edd72dcd92","client-request-id":"31088810-bb70-466a-895c-925e315ef7a8"}}}
This documentation states that body is not required.
I extracted this error from the BatchResponseContentCollection itself in the debugger, because none of the APIs provided returns a response for the actual request.
BatchResponseContentCollection.GetResponseByIdAsync does not return any responses for the error even though the collection itself have the proper ids:
1. Confirming requestId
2.1. Confirming that response exists
2.2 Confirming that key that associated with the response exists
3. Confirming that response is not returned by proper id
Expected behavior
If no error, POST request is executed inside batch.
If error, return the request error with BatchResponseContentCollection.GetResponseByIdAsync
How to reproduce
Just include _graphClient.Me.Messages[messageId].Send.ToPostRequestInformation() request information inside a batch using AddBatchRequestStepAsync
SDK Version
5.56.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the batch request using AddBatchRequestStepAsync with Messages.Item.SendRequestBuilder.ToPostRequestInformation(). Inspect the batch handling around that request and BatchResponseContentCollection.GetResponseByIdAsync. Done means the POST executes in a batch or its error is returned by the response lookup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100