You can use the application principal to create contacts in your account. Please note that you cannot use delegated permissions
, because delegated permissions
are limited to creating contacts yourself. According to your question, you should use application permissions
and then call the /users/{your user id}
endpoint to create contacts for your account (note that this process will not involve users, this is your application principal completed). In addition, since the Outlook API has been deprecated, I recommend you to use the latest MS graph api.
Therefore, you need to grant the Contacts.ReadWrite
application permission to your application, then use the client credential flow to obtain the token, and then use the token to call the /contacts
endpoint.
POST https://graph.microsoft.com/v1.0/users/{user id}/contacts
Content-type: application/json
{
"givenName": "Pavel",
"surname": "Bansky",
"emailAddresses": [
{
"address": "pavelb@fabrikam.onmicrosoft.com",
"name": "Pavel Bansky"
}
],
"businessPhones": [
"+1 732 555 0102"
]
}
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.