Facing some error when creating event ?

Copper Contributor

Error "UnableToDeserializePostBody" when trying to create calendar event(Microsoft Teams) through Outlook 1.0 API

Hi Team,

I am trying to create a microsoft teams meeting using graph API(post).

I have used Post request(v1.0) to a url : https://graph.microsoft.com/v1.0/me/events and I am using "application/json" as content type .

 

But, when I triggered the url, It is throwing me an 400 error :"code": "UnableToDeserializePostBody".

 

I have provided all the details in the body like :attendees,starttime,endtime and also below parameters.

 

"isOnlineMeeting": "True",

"onlineMeetingProvider": "teamsForBusiness"

 

Please kindly help me to resolve this issue!

 

9 Replies

Hi @livecid7692b37964fb, could you please verify the create event document and consent all application level permissions. 

I have gave all permission and meeting schedule on skype but i need to schedule on microsoft team...
Could you share the error details with us.
Show Errror:
body: {
error: {
code: 'UnableToDeserializePostBody',
message: 'were unable to deserialize '
}
}
could you please share the request body, so that i can try it from my end

@Jagadeesh-MSFT

yes sure,
Here is my code,
var token = "token..."
var newEvent = {
"Subject": "Title of Event",
"Body": {
"ContentType": "HTML",
"Content": "Description of Event",
},
"Start": {
"DateTime": "2021-05-26 20:35",
"TimeZone": "UTC"
},
"End": {
"DateTime": "2021-05-26 20:35",
"TimeZone":"UTC"
},
"Attendees": [
{
"EmailAddress": {
"Address": "xyz@gmail.com",
"Name": "Dummy Name"
},
"Type": "Required"
}
],
'IsOnlineMeeting': true,
'onlineMeetingProvider': 'teamsForBusiness' //teamsForBusiness, skypeForConsumer
};

// Pass the user's email address
var userInfo = {
email: "abc@gmail.com", // organiser Email
name: "ABC" // organiser Name
};
outlook.calendar.createEvent({token: token, event: newEvent, user: userInfo},
function(error, result){
if (error) {
callback(error,null);
}
else if (result) {
callback(null,result);
}
});


Here is Response
error: 'REST request returned 400; body: {"error":{"code":"UnableToDeserializePostBody","message":"were unable to deserialize "}}'

Please help..
Thanks..

Hello, @Jagadeesh-MSFT
Are you find any soultions... ? please help...
Hi @livecid7692b37964fb, I have tested and it is working fine with your code in the document which I have shared with you. I think there were some errors in your code, could you please check once. Have you tried with the code in the document.
Thanks for replying,
It's working and its return skype join url i need to join with microsoft team url.
So, Please suggest me how we can get Microsoft Team URL ?