Reputation: 902
Using Microsoft Graph REST API, we create an Outlook calendar event
Focus on the body
attribute:
{
...,
"body": {
"contentType": "text",
"content": "Test\n\nTest"
}
}
We would expect the event's description, as shown in Outlook Calendar and in Teams Calendar (Microsoft Teams > Calendar tab), to then be:
Test
Test
This is the case in Outlook calendar (outlook.com). However, in Teams Calendar, it displays as:
Test Test
We've also tried \r\nTest\r\n\r\nTest\r\n
with the same result.
How can we have linebreaks in the description/body of the event we create, correctly displayed in Outlook and Teams?
Upvotes: 2
Views: 869
Reputation: 595
Simply change the contentType to HTML but use the exact text you have.
Based on my experiments this works correctly in both teams and outlook
Upvotes: 0
Reputation: 2590
According to the itemBody documentation of the event, you can also add it as html. Then you'll know for sure how it's is going to look.
{
"body": {
"contentType": "html",
"content": "<h1>test</h1><br />\n<p>test</p>"
}
}
Keep in mind that not all html is supported, but it should get you a long way. And "nice" html isn't really a requirement, so this would also work:
test<br />\ntest
Upvotes: 2