How to add multiple events in outlook using batch and what url should I add in batch ?

Kajal Nagare 1 Reputation point
2021-09-01T04:16:09.317+00:00

Trying to add multiple events using batch but showing error, unable to deserialize content

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,106 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sheena-MSFT 1,731 Reputation points
    2022-03-07T17:03:24.867+00:00

    Hi @Kajal Nagare ,

    To add multiple events in outlook using batching use the following URL and Request Body

    POST https://graph.microsoft.com/v1.0/$batch  
    {  
        "requests": [  
            {  
                "id": "1",  
                "method": "POST",  
                "url": "/me/calendars/events",  
                "body": {  
                    "subject": "Let's go for lunch",  
                    "body": {  
                        "contentType": "HTML",  
                        "content": "Does mid month work for you?"  
                    },  
                    "start": {  
                        "dateTime": "2019-03-15T12:00:00",  
                        "timeZone": "Pacific Standard Time"  
                    },  
                    "end": {  
                        "dateTime": "2019-03-15T14:00:00",  
                        "timeZone": "Pacific Standard Time"  
                    },  
                    "location": {  
                        "displayName": "Harry's Bar"  
                    },  
                    "attendees": [  
                        {  
                            "emailAddress": {  
                                "address": "adelev@contoso.onmicrosoft.com",  
                                "name": "Adele Vance"  
                            },  
                            "type": "required"  
                        }  
                    ]  
                },  
                "headers": {  
                    "Content-Type": "application/json"  
                }  
            },  
            {  
                "id": "2",  
                "method": "POST",  
                "url": "/me/calendars/events",  
                "body": {  
                    "subject": "Let's go for lunch 2",  
                    "body": {  
                        "contentType": "HTML",  
                        "content": "Does mid month work for you?"  
                    },  
                    "start": {  
                        "dateTime": "2019-03-15T12:00:00",  
                        "timeZone": "Pacific Standard Time"  
                    },  
                    "end": {  
                        "dateTime": "2019-03-15T14:00:00",  
                        "timeZone": "Pacific Standard Time"  
                    },  
                    "location": {  
                        "displayName": "Harry's Bar"  
                    },  
                    "attendees": [  
                        {  
                            "emailAddress": {  
                                "address": "adelev@contoso.onmicrosoft.com",  
                                "name": "Adele Vance"  
                            },  
                            "type": "required"  
                        }  
                    ]  
                },  
                "headers": {  
                    "Content-Type": "application/json"  
                }  
            },  
            {  
                "id": "3",  
                "method": "POST",  
                "url": "/me/calendars/events",  
                "body": {  
                    "subject": "Let's go for lunch 3",  
                    "body": {  
                        "contentType": "HTML",  
                        "content": "Does mid month work for you?"  
                    },  
                    "start": {  
                        "dateTime": "2019-03-15T12:00:00",  
                        "timeZone": "Pacific Standard Time"  
                    },  
                    "end": {  
                        "dateTime": "2019-03-15T14:00:00",  
                        "timeZone": "Pacific Standard Time"  
                    },  
                    "location": {  
                        "displayName": "Harry's Bar"  
                    },  
                    "attendees": [  
                        {  
                            "emailAddress": {  
                                "address": "adelev@contoso.onmicrosoft.com",  
                                "name": "Adele Vance"  
                            },  
                            "type": "required"  
                        }  
                    ]  
                },  
                "headers": {  
                    "Content-Type": "application/json"  
                }  
            }  
        ]  
    }  
    

    Note: At a time we can create four events only.

    180743-batching.png

    Reference:throttling

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments