KaMing
KaMing

Reputation: 1

Microsoft Graph SDK: How many steps will be executed in a batch request

currently I am working with the MS Graph SDK to retrieve and move messages from one folder to another after some business logic. To move the messages/e-mails I use the batch request functionality. By trying to move 6 messages in a batch request only 4 of them will be handled and moved. The 2 messages stayed in the source folder. After I trigger the process another time the remaining 2 messages have been moved to the target folder.

Here is the code where the request steps will be added to the batch request (imagine that in the list of idsOfMessagesToMove are 6 elements):

for (String idOfMessageToMove : idsOfMessagesToMove) {

        MessageMoveRequest messageMoveRequest = this.graphServiceClient.users(EMAIL_ACCOUNT)
                .mailFolders(MailboxFolderEnum.MAILBOX_FOLDER_INBOX.getFolderName()).messages(idOfMessageToMove)
                .move(MessageMoveParameterSet.newBuilder().withDestinationId(mailFolderDestination.getFolderName())
                        .withDestinationId(mailFolderDestination.getFolderName()).build()).buildRequest();

        messageMoveRequest.addHeader("Content-Type", "application/json");

        batchRequestContent.addBatchRequestStep(messageMoveRequest, HttpMethod.POST, messageMoveRequest.body);
}

Can somebody confirm that always only 4 steps in a batch request will be executed, and if not do you have a clue why this happen?

Many thanks in advance.

Best, Ka-Ming

Upvotes: 0

Views: 283

Answers (1)

TheGDog
TheGDog

Reputation: 27

Here... this link mentions the limit of 4 concurrent requests attempting to perform an operation on the same mailbox and the concurrency error you'll get if you go over that :

Mailbox concurrency limit issue

Upvotes: 0

Related Questions