outlookmicrosoft-graph-apimicrosoft-teams

Scheduling MS Teams meeting programmatically sends email but doesn't include meeting link


I am trying to create an application that allows the user to schedule MS Teams Meeting. I followed https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=http#example-4-create-and-enable-an-event-as-an-online-meeting. I am getting the email but not the joining link. I tried different ways but I am stuck at this for a day now. Any help is appreciated.

Sample Request:

{
    "subject": "Let's go for lunch",
    "body": {
      "contentType": "HTML",
      "content": "Does noon work for you?"
    },
    "start": {
        "dateTime": "2017-04-15T12:00:00",
        "timeZone": "Pacific Standard Time"
    },
    "end": {
        "dateTime": "2017-04-15T14:00:00",
        "timeZone": "Pacific Standard Time"
    },
    "location":{
        "displayName":"Harry's Bar"
    },
    "attendees": [
      {
        "emailAddress": {
          "address":"samanthab@contoso.com",
          "name": "Samantha Booth"
        },
        "type": "required"
      }
    ],
    "allowNewTimeProposals": true,
    "isOnlineMeeting": true,
    "onlineMeetingProvider": "teamsForBusiness"
  }

Expected response (with Teams join link)

{
    "@odata.etag":"W/\"ZlnW4RIAV06KYYwlrfNZvQAALfZeRQ==\"",
    "id":"AAMkAGI1AAAt8AHjAAA=",
    "createdDateTime":"2017-04-15T03:00:50.7579581Z",
    "lastModifiedDateTime":"2017-04-15T03:00:51.245372Z",
    "categories":[
    ],
    "originalStartTimeZone":"Pacific Standard Time",
    "originalEndTimeZone":"Pacific Standard Time", 
    "reminderMinutesBeforeStart":15,
    "isReminderOn":true,
    "hasAttachments":false,
    "hideAttendees": false,
    "subject":"Let's go brunch",
    "bodyPreview":"Does noon work for you?",
    "importance":"normal",
    "sensitivity":"normal",
    "isAllDay":false,
    "isCancelled":false,
    "isDraft": false,
    "isOrganizer":true,
    "responseRequested":true,
    "seriesMasterId":null,
    "showAs":"busy",
    "type":"singleInstance",
    "onlineMeetingUrl":null,
    "isOnlineMeeting": true,
    "onlineMeetingProvider": "teamsForBusiness",
    "allowNewTimeProposals": true,
    "responseStatus":{
        "response":"organizer",
        "time":"0001-01-01T00:00:00Z"
    },
    "body":{
        "contentType":"html",
        "content":"<html><head></head><body>Does late morning work for you?</body></html>"
    },
    "start":{
        "dateTime":"2017-04-15T11:00:00.0000000",
        "timeZone":"Pacific Standard Time"
    },
    "end":{
        "dateTime":"2017-04-15T12:00:00.0000000",
        "timeZone":"Pacific Standard Time"
    },
    "location": {
        "displayName": "Harry's Bar",
        "locationType": "default",
        "uniqueId": "Harry's Bar",
        "uniqueIdType": "private"
    },
    "locations": [
        {
            "displayName": "Harry's Bar",
            "locationType": "default",
            "uniqueIdType": "unknown"
        }
    ],
    "recurrence":null,
    "attendees":[
        {
            "type":"required",
            "status":{
                "response":"none",
                "time":"0001-01-01T00:00:00Z"
            },
            "emailAddress":{
                "name":"Samantha Booth",
                "address":"samanthab@contoso.com"
            }
        }
    ],
    "organizer":{
        "emailAddress":{
            "name":"Dana Swope",
            "address":"danas@contoso.com"
        }
    },
    "onlineMeeting": {
        "joinUrl": "https://teams.microsoft.com/l/meetup-join/19%3ameeting_NzIyNzhlMGEtM2YyZC00ZmY0LTlhNzUtZmZjNWFmZGNlNzE2%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%22bc55b173-cff6-457d-b7a1-64bda7d7581a%22%7d",
        "conferenceId": "177513992",
        "tollNumber": "+1 425 555 0123"
    }
}

Actual Response:

{
    "categories": [],
    "transactionId": null,
    "originalStartTimeZone": "Pacific Standard Time",
    "originalEndTimeZone": "Pacific Standard Time",
    "reminderMinutesBeforeStart": 15,
    "isReminderOn": true,
    "hasAttachments": false,
    "subject": "Let's go for lunch",
    "bodyPreview": "Does noon work for you?",
    "importance": "normal",
    "sensitivity": "normal",
    "isAllDay": false,
    "isCancelled": false,
    "isOrganizer": true,
    "responseRequested": true,
    "seriesMasterId": null,
    "showAs": "busy",
    "type": "singleInstance",
    "onlineMeetingUrl": null,
    "isOnlineMeeting": false,
    "onlineMeetingProvider": "unknown",
    "allowNewTimeProposals": true,
    "occurrenceId": null,
    "isDraft": false,
    "hideAttendees": false,
    "responseStatus": {
        "response": "organizer",
        "time": "0001-01-01T00:00:00Z"
    },
    "body": {
        "contentType": "html",
        "content": "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>Does noon work for you?</body></html>"
    },
    "start": {
        "dateTime": "2017-04-15T12:00:00.0000000",
        "timeZone": "Pacific Standard Time"
    },
    "end": {
        "dateTime": "2017-04-15T14:00:00.0000000",
        "timeZone": "Pacific Standard Time"
    },
    "location": {
        "displayName": "Harry's Bar",
        "locationType": "default",
        "uniqueId": "Harry's Bar",
        "uniqueIdType": "private"
    },
    "locations": [
        {
            "displayName": "Harry's Bar",
            "locationType": "default",
            "uniqueId": "Harry's Bar",
            "uniqueIdType": "private"
        }
    ],
    "recurrence": null,
    "attendees": [
        {
            "type": "required",
            "status": {
                "response": "none",
                "time": "0001-01-01T00:00:00Z"
            },
            "emailAddress": {
                "name": "Attendee"
            }
        }
    ],
    "organizer": {
        "emailAddress": {
        }
    },
    "onlineMeeting": null
}

Whatever I do,, the onlineMeeting is always null.


Solution

  • The issue occurs if teams for business meeting provider that is Online Teams Meeting is not enabled for the user in Outlook.

    Check if the user is enabled for teamsForBusiness like below:

    https://graph.microsoft.com/v1.0/me/calendar
    

    enter image description here

    "allowedOnlineMeetingProviders": [
    "teamsForBusiness"
    ],
    "defaultOnlineMeetingProvider": "teamsForBusiness"
    

    If the user is not enabled with Teams for Business, then the response will be like below:

    "allowedOnlineMeetingProviders": [],  
    "defaultOnlineMeetingProvider": "unknown",
    

    Hence to resolve the error, make sure that Teams for Business meeting provider is enabled for the user.

    I am able to create the online meeting with onlineMeeting join URL:

    https://graph.microsoft.com/v1.0/me/events
    
    {
    "subject": "Let's go for lunch",
    "body": {
    "contentType": "HTML",
    "content": "Does noon work for you?"
    },
    "start": {
    "dateTime": "2024-03-25T12:00:00",
    "timeZone": "Pacific Standard Time"
    },
    "end": {
    "dateTime": "2024-03-25T14:00:00",
    "timeZone": "Pacific Standard Time"
    },
    "location": {
    "displayName": "Harry's Bar"
    },
    "attendees": [
    {
    "emailAddress": {
    "address": "xxx@contoso.com",
    "name": "Name"
    },
    "type": "required"
    }
    ],
    "allowNewTimeProposals": true,
    "isOnlineMeeting": true,
    "onlineMeetingProvider": "teamsForBusiness"
    }
    

    enter image description here

    Reference:

    Microsoft Teams URL is missed when creating a event by Graph API - Microsoft Q&A by JanardhanaVedham-MSFT