Add directory room to calendar event Microsoft Graph API

Volle Cyril 1 Reputation point
2022-01-18T10:30:08.073+00:00

Hi,

I need to add room to calendar event :

Example correct view with an event form outlook :

        "location": {
            "displayName": "MyRoom",
            "locationUri": "room@mail.com",
            "locationType": "conferenceRoom",
            "uniqueId": "room@mail.com",
            "uniqueIdType": "directory",
            "address": {
                "street": "",
                "city": "",
                "state": "",
                "countryOrRegion": "",
                "postalCode": ""
            },
            "coordinates": {}
        },

But when I use this field with PHP Microsoft Graph like this :

        "locations": [
            {
                "displayName": "MyRoom",
                "locationUri":  "room@mail.com",
                "locationType": "conferenceRoom",
                "uniqueId":  "room@mail.com",
                "uniqueIdType": "directory"
            }
        ],

It doen't work, event is returned as :

        "location": {
            "displayName": "MyRoom",
            "locationType": "default",
            "uniqueId": "MyRoom",
            "uniqueIdType": "private"
        },

Where is my mistake ?

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,587 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,686 Reputation points Microsoft Vendor
    2022-01-27T17:35:30.683+00:00

    Hi @Volle Cyril ,

    With the following request body, calendar event is gets created.

    POST /user/{user-id}/events  
      
    "location": {  
    	"displayName": "meetingroom",  
    	"locationUri": "meetingroom@contoso.onmicrosoft.com",  
    	"locationType": "conferenceRoom",  
    	"uniqueId": "meetingroom@contoso.onmicrosoft.com",  
    	"uniqueIdType": "directory"  
    }  
    

    For more information please refer to user-post-events.
    Hope this helps.

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

    0 comments No comments