title: Sending Messages through Microsoft Graph API with SchemaExtension Data
body: <p>I'm looking for some help formatting schema extension data in Microsoft's Graph API. I've been able to successfully send Office 365 messages in code and through the Graph Explorer using this body:</p>
  
  <pre><code>{
    "message": {
      "subject": "Test Subject",
      "body": {
        "contentType": "Text",
        "content": "Test Body "
      },
      "toRecipients": [
        {
          "emailAddress": {
            "address": "foo@email.com"
          }
        }
      ]
    }
  }
  </code></pre>
  
  <p>I created a schema extension and promoted it to "Available" status. I can query the extension to verify it's available and get this response body:</p>
  
  <pre><code>{
      "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#schemaExtensions",
      "value": [
          {
              "id": "extc5bnq6uk_TestExtension",
              "description": "Test Extension",
              "targetTypes": [
                  "Message"
              ],
              "status": "Available",
              "owner": "mysecretclienttenantgoeshere",
              "properties": [
                  {
                      "name": "ValueOne",
                      "type": "String"
                  },
                  {
                      "name": "ValueTwo",
                      "type": "String"
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>So far I haven't been able to append extension data to a new message. I've tried formatting my request body like this:</p>
  
  <pre><code>{
    "message": {
      "subject": "Test Subject",
      "body": {
        "contentType": "Text",
        "content": "Test Body "
      },
      "toRecipients": [
        {
          "emailAddress": {
            "address": "foo@email.com"
          }
        }
      ],
      "extc5bnq6uk_TestExtension": {
        "ValueOne": "TestValue",
        "ValueTwo": "TestValue"
      }
    }
  }
  </code></pre>
  
  <p>and like this:</p>
  
  <pre><code>{
    "message": {
      "subject": "Test Subject",
      "body": {
        "contentType": "Text",
        "content": "Test Body "
      },
      "toRecipients": [
        {
          "emailAddress": {
            "address": "foo@email.com"
          }
        }
      ],
      "extensions":[
      {
          "extc5bnq6uk_TestExtension" : {
              "ValueOne" : "TestValue"
              "ValueTwo" : "TestValue"
          }
      }
      ]
    }
  }
  </code></pre>
  
  <p>Both formats return a 400 code with response body:</p>
  
  <pre><code>{
      "error": {
          "code": "RequestBodyRead",
          "message": "The property 'extc5bnq6uk_TestExtension' does not exist on type 'Microsoft.OutlookServices.Message'. Make sure to only use property names that are defined by the type or mark the type as open type.",
          "innerError": {
              "request-id": "21792fd0-44d1-42aa-8d51-f8abc92cbd04",
              "date": "2018-08-14T16:39:31"
          }
      }
  }
  </code></pre>
  
  <p>I'm posting to this URL in the graph explorer:</p>
  
  <blockquote>
    <p><a href="https://graph.microsoft.com/v1.0/me/sendMail" rel="nofollow noreferrer">https://graph.microsoft.com/v1.0/me/sendMail</a></p>
  </blockquote>
  
  <p>and to the "messages" and "sendMail" endpoints in code.</p>