I'm trying to do a batch request using MS Graph .NET SDK as shown here: https://docs.microsoft.com/en-us/graph/sdks/batch-requests?tabs=csharp The only problem is that when I run the code, nothing happens. I'm trying to move a set of emails (stored in a list) to another mail folder. Am I missing anything? The move request is here https://docs.microsoft.com/en-us/graph/api/message-move?view=graph-rest-1.0&tabs=http When used in a single query it works, but not when batching. Below you will find the code, in this case I'm looping to 20 just to test as 20 is the maximum queries per batch. Thanks in advance.
for (int i = 0; i < 20; i++)
{
var mail = invalidMessages[i];
var userRequest = client.Me.Messages[mail.Id]
.Move(failureFolderID)
.Request();
requestID = batchRequestContent.AddBatchRequestStep(userRequest);
}
var returnedResponse = await client.Batch.Request().PostAsync(batchRequestContent);
EDIT: I tried to change the method to POST
userRequest.Method = System.Net.Http.HttpMethod.Post;
but I get a ServiceException: 'Code: BadRequest Message: Write request id : fe23b1c1-663d-4499-829a-291d04a12b48 does not contain Content-Type header or body.'