i want to send teams message from my MS access VBA:
-i have created an application on Azure portal (SendMessageFromDMH)
- i have logged in to office using my Microsoft user : "Mohamed.s-yassin@qnbalahli.com"
-i have followed the steps to get the authorization code : "https://login.microsoftonline.com/{Application Directory (tenant) ID}/oauth2/v2.0/authorize?"
-i have followed the steps to get the access_token : "https://login.microsoftonline.com/{Application Directory (tenant) ID}/oauth2/v2.0/token?"
-i have followed the steps to send chat message to existing chat : "https://graph.microsoft.com/v1.0/chats/{chat id}/messages" --- "hello world"
-the problem that i want to send message to new user (not existing chat ) by following :
-create chat as : https://learn.microsoft.com/en-us/graph/api/chat-post?view=graph-rest-1.0&tabs=http
"https://graph.microsoft.com/v1.0/chats"
-
{ "chatType": "oneOnOne",
"members": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('Mohamed.s-yassin@qnbalahli.onmicrosoft.com')" ' this for Mohamed.s-yassin@qnbalahli.com
},
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('moyassinomar@onmicrosoft.com')" ' this for moyassinomar@Stuff .com
}
]
}
but it gives me below error :
{"error":{"code":"Unauthorized","message":"Failed to make request to Azure Active directory","innerError":{"date":"2022-02-09T13:25:45","request-id":"b64280bc-1e2e-4989-9cf1-c485bf2088e8","client-request-id":"b64280bc-1e2e-4989-9cf1-c485bf2088e8"}}}
could you support how to solve this error and guide me hot send the message to non exisiting chat?