Skip to main content
March 11, 2021
Solved

Graph API get messages with content type of text

  • March 11, 2021
  • 2 replies
  • 0 views

Hi all,

I'm working on a graph API integration where I get and load in messages from Graph API. I've got a minor problem in which the content is always returned in html. 

In the get message documentation (Get message - Microsoft Graph v1.0 | Microsoft Docs) there is a header, 'Prefer: outlook.body-content-type' which allows for the return type to be set to text which makes it easier to extract the content. 

The problem is, when I put this in the header field on an integration I get the following error message: 

The header name Prefer: outlook.body-content-type is not valid. A header name may only contain letters, numbers, and the following special characters ! # $ % & ’’ * + - . ^ _ ` | ~ 

When I try to break the header up it always returns failure. Does anyone know the correct format to put the header name and value pair in?

Thanks in advance

Best answer by stefanhelzle0001

https://github.com/microsoftgraph/microsoft-graph-docs/issues/4156

tells me

had the same as you because I wrote my header wrong. Try it with this:
Header:

Name: Prefer
Value: outlook.body-content-type="text"

2 replies

stefanhelzle0001
Brainy
March 11, 2021

https://github.com/microsoftgraph/microsoft-graph-docs/issues/4156

tells me

had the same as you because I wrote my header wrong. Try it with this:
Header:

Name: Prefer
Value: outlook.body-content-type="text"

March 11, 2021

That works, thanks Stefan!