Reputation: 1
I am creating new graph event with graph-v1 with "openTypeExtension" and "attendees" but when i create event for user who has not verified outlook to send email then it gives me 403 error.
I handled it in catch block for my database but after failing request-promise for API call it creates new event at Microsoft calendar and sends me back in web-hook without containing my extensions. So, it can't identify the event and web-hook's method stores it as new event.
Here is my code for API request-promise:
var options = {
method: 'POST',
uri: 'https://graph.microsoft.com/v1.0/me/events',
headers: {
Authorization: 'Bearer ' + [ACCESS_TOKEN],
'content-Type': 'application/json',
},
body: JSON.stringify({
"subject": agenda.title,
"body": {
"contentType": "HTML",
"content": ""
},
"start": {
"dateTime": agenda.start.time,
"timeZone": agenda.start.timeZone
},
"end": {
"dateTime": agenda.end.time,
"timeZone": agenda.end.timeZone
},
"location": {
"displayName": [NAME]
},
"extensions": [
{
"@odata.type": "microsoft.graph.openTypeExtension",
"extensionName": [EXT_NAME],
"agendaId": [ID]
}
],
"attendees": [
{
"emailAddress": {
"address": [EMAIL]
},
"type": "required"
}
]
}),
};
I am getting this error :
{ StatusCodeError: 403 - "{\r\n \"error\": {\r\n \"code\": \"ErrorMessageSubmissionBlocked\",\r\n\"message\": \"Cannot send mail. Follow the instructions in your Inbox to verify your account.\",\r\n\"innerError\": {\r\n \"request-id\": \"bec4fcaf-7eaa-4473-a53d-6cab6b2c8b8c\",\r\n
\"date\"\"2019-01-22T07:42:01\"\r\n }\r\n }\r\n}", name: 'StatusCodeError', statusCode: 403, message: '403 - "{\r\n \"error\": {\r\n \"code\": \"ErrorMessageSubmissionBlocked\",\r\n \"message\": \"Cannot send mail. Follow the instructions in your Inbox to verify your account.\",\r\n \"innerError\": {\r\n \"request-id\": \"bec4fcaf-7eaa-4473-a53d-6cab6b2c8b8c\",\r\n \"date\": \"2019-01-22T07:42:01\"\r\n }\r\n }\r\n}"', error: '{\r\n "error": {\r\n "code": "ErrorMessageSubmissionBlocked",\r\n
"message": "Cannot send mail. Follow the instructions in your Inbox to verify your account.",\r\n "innerError": {\r\n "requestid": "bec4fcaf-7eaa-4473-a53d-6cab6b2c8b8c",\r\n "date": "2019-01-22T07:42:01"\r\n }\r\n\r\n}' .... .... }
for that I handled it with 'statusCode' in catch() for my database but after this call fails I am getting 'webhook' call for new event generated from 'Microsoft calendar' which doesn't contain my extension so it behaves as 'Microsoft event' not my application 'Agenda event'.
So, Is there any I prevent the new event at 'Microsoft calendar' or Any solution for my extensions?
Upvotes: 0
Views: 604
Reputation: 11
The same problem occurred to me as well. for resolution, you are suppose to go to your MICROSOFT account portal and login. at the time of login it will ask you to verify your mobile number. as soon as you will verify it, you will be able send email perfectly.
Upvotes: 1