Graph API SendMail through AAD App with Client Secret results in Error

Stefan 1 Reputation point
2022-01-25T16:09:50.937+00:00

The Problem:
I want to send an email via graph api through Azure Active Directory App authorization. The app in aad does have all the necessary api permissions which would be needed for that request. I create an bearer token through postman which is used for authorization to send the mail. The Token is generated through https://login.microsoftonline.com//oauth2/v2.0/token and does include all api permissions. With this I want to access the Graph API https://graph.microsoft.com/v1.0/users//sendMail. However, when calling the API I get the following error: The property 'subject' 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. REST APIs for this mailbox are currently in preview. You can find more information about the preview REST APIs at https://dev.outlook.com/."
If I use the token which is generated in graph explorer in my postman request it works just fine. The authorization is done through a client secret in postman.

Expected behavior:

{
"error": {
"code": "RequestBodyRead",
"message": "The property 'subject' 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. REST APIs for this mailbox are currently in preview. You can find more information about the preview REST APIs at https://dev.outlook.com/.",
"innerError": {
"date": "2022-01-11T14:42:45",
"request-id": "5aa0b96c-6537-420b-94df-50ef811f90a0",
"client-request-id": "5aa0b96c-6537-420b-94df-50ef811f90a0"
}
}
}

Operating System:
OS: Windows 10 Enterprise
Browser MS Edge
Version 97.0.1072.55

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
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,349 questions
{count} votes