Skip to content

Batch Request & Azure App Service #2681

Closed
@PatrickKelley2112

Description

@PatrickKelley2112

Describe the bug

I have a batch request that works flawlessly when I'm debugging on IIS Express, but as soon as I publish to an Azure App Service the batch returns error 400 for every request in the batch.

The max number of user calendars I'm requesting is around 10, but it fails even if I just add 1 to the batch. I can pull individual calendars using CalendarView.GetAsync locally or on the app service so it's definitely something with the batch request.

Expected behavior

Returns user calendar events.

How to reproduce

 foreach (var user in users)
 {
     var eventRequest = graphClient.Users[user.UserPrincipalName].CalendarView
                    .ToGetRequestInformation(requestConfiguration =>
                    {
                        requestConfiguration.QueryParameters.StartDateTime = startTime.ToString();
                        requestConfiguration.QueryParameters.EndDateTime = endTime.Value.ToString();
                    });

     eventRequests.Add(await batchRequestContent.AddBatchRequestStepAsync(eventRequest, user.UserPrincipalName));

 }
 
 var returnedResponse = await graphClient.Batch.PostAsync(batchRequestContent);

List<Event> events = [];
foreach (var r in eventRequests)
{
    var response = await returnedResponse
      .GetResponseByIdAsync<EventCollectionResponse>(r);

    var pageIterator = PageIterator<Event, EventCollectionResponse>
   .CreatePageIterator(graphClient, response, (evt) =>
   {
       events.Add(new Event(evt));
       return true;
   });

    await pageIterator.IterateAsync();
}


return events;

SDK Version

5.58

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_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions