Search code examples
microsoft-graph-apimicrosoft-graph-calendar

Response 400 on Microsoft Graph - Create calendar event: Property emailAddress in payload has a value that does not match schema


I'm creating a new calendar event through Microsoft Graph. I'm trying to insert organizer information on a Graph Calendar Event

if organizer.get('email'):
    log('email: ')
    log(organizer.get('email', ''))


eventJson["organizer"] = {
    "emailAddress": {
        "address":str(organizer.get('email', ''))
    }
}

log:

2019-05-17T17:05:45.421475+00:00 app[web.1]: ERROR
2019-05-17T17:05:45.421493+00:00 app[web.1]: <Response [400]>
2019-05-17T17:05:45.421501+00:00 app[web.1]: 
{
  "error": {
    "code": "BadRequest",
    "message": "Property emailAddress in payload has a value that does not match schema.",
    "innerError": {
      "request-id": "xxxxxxxxxxxx",
      "date": "2019-05-17T17:05:45"
    }
  }
}

I have already checked organizer.get('email') content. Also, in some other events, the same structure worked well. I don't know what the schema expects.

This is the example I have found on the documentation

"organizer": {
    "emailAddress": {
        "name": "Megan Bowen",
        "address": "MeganB@contoso.OnMicrosoft.com"
    }
}

Solution

  • The organizer property is automatically set the owner of the calendar where the event was created. It isn't a property you can set. If you look at the examples, you'll see that organizer only shows up in the Response, not the Request.