Graph Message API sometimes returns LegacyExchangeDN

Salvi Jansen 1 Reputation point
2021-02-11T08:08:05.793+00:00

Hi Microsoft!

I am using the Graph API v1.0 to query the /messages endpoint. According to the Message object properties, there is a property called "From" which is of type Recipient, which means it has a property emailAddress, which is of type emailAddress. To get the actual email address you need the address property. So from.emailAddress.address should always return an email address.

I performed the following query:

GET https://graph.microsoft.com/v1.0/me/messages?$filter=conversationId eq '{some-conversation-id}'&$select=id,createdDateTime,internetMessageId,subject,from&$top=20  

I then performed the following query, which is exactly the same apart from one extra property returned:

GET https://graph.microsoft.com/v1.0/me/messages?$filter=conversationId eq '{some-conversation-id}'&$select=id,createdDateTime,internetMessageId,subject,from,bodyPreview&$top=20  

Query 1 did not return an email address for all from.emailAddress.address values, but some string that Exchange experts seem to call the "LegacyDN" or "LegacyExchangeDN" field instead. By adding some random other property in Query 2, it did resolve to the email address. The problem seems to occur in some messages sent by me. For incoming messages the from is always an email address.

66857-graph-messages.png

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,477 questions
{count} votes