Open Dethras opened 3 months ago
Thanks for raising this @Dethras
To clarify,
BatchRequestContent
but not with BatchRequestContentCollection
? Hi @andrueastman
batch
request (For the https://graph.microsoft.com/v1.0/$batch call) [Note: For each individual request it is already supported through BatchRequestStep
]BatchRequestContent
since I can use graphClient.Batch.ToPostRequestInformationAsync
and then access the RequestHeaders
through the RequestInformation
Thanks for the extra information here @Dethras
In my head, BatchRequestContentCollection
still ends up splitting the requests into BatchRequestContent
instances as the API only accepts 20 items at a time. So, this may still be possible.
Any chance you can also share a code example of how you send the request once you get the RequestInformation
object?
@andrueastman Apologies for the late reply.
Here is how I am currently doing it using the BatchRequestContent
and it's ToPostRequestInformationAsync
var batchToProcess = new BatchRequestContent(graphClient, <Insert max 20 BatchRequest Steps Here>)
var requestInfo = await graphClient.Batch.ToPostRequestInformationAsync(batchToProcess);
requestInfo.Headers.Add(<Header Name>,<Header Value>);
var locationResponseHandler = new NativeResponseHandler();
requestInfo.SetResponseHandler(locationResponseHandler);
await graphClient.RequestAdapter.SendNoContentAsync(requestInfo, cancellationToken: cancellationToken);
var batchResponse = new BatchResponseContent(locationResponseHandler.Value as HttpResponseMessage);
var responses = await batchResponse.GetResponsesStatusCodesAsync();
Is your feature request related to a problem? Please describe the problem.
I have a specific case where I need to pass something through a Header to be accessed in a DelegatingHandler, with the addition of BatchRequestContentCollection, BatchRequestContent has become obsolete, and there is no way to access the Headers via BatchRequestContentCollection or via graphClient.Batch.PostAsync(BatchRequestContentCollection)
Describe the solution you'd like.
BatchRequestContentCollection or graphClient.Batch.PostAsync(BatchRequestContentCollection) should accept RequestHeaders/RequestInformation, and they should be added with every batch call made with the graphClient.Batch.PostAsync(BatchRequestContentCollection).
Additional context?
No response