My main goal is to get the alias of an MS365 Group that an email was sent to, since in the toRecipients address, it resolves to the primary SMTP address. I have determined that the possible route I have to go to get this is through the email headers. This information appears in outlook when I click on "view message details" button in the email actions toolbar.
I've looked at the following questions:
Microsoft Graph : How get alias email from message
Find the email aliases a message was actually sent to
Microsoft Graph: How to get the alias from an email message?
Can you get PR_TRANSPORT_MESSAGE_HEADERS 0x007D from the .Net Microsoft Graph API?
However, when I try something like
https://graph.microsoft.com/v1.0/groups/{group-id}/threads/{thread-id}?$select=internetMessageHeaders&$expand=singleValueExtendedProperties($filter=id eq 'String 0x007D')
or
https://graph.microsoft.com/v1.0/groups/{group-id}/threads/{thread-id}?$expand=singleValueExtendedProperties($filter=id eq 'String 0x007D')
I get this error
Parsing OData Select and Expand failed: Could not find a property named 'singleValueExtendedProperties' on type 'microsoft.graph.conversationThread'
ConversationThread is an object that represents that whole thread of a conversation which main contain one or many messages (or they are refereed to as posts). So you need to first get all the associated posts /groups/{groupId}/conversations/{conversationId}/threads/{threadId}/posts. Then using the Id of a particular post that you are interested eg
GET /groups/{id}/threads/{id}/posts/{id}?$expand=singleValueExtendedProperties($filter=id eq '{id_value}')
GET /groups/{id}/conversations/{id}/threads/{id}/posts/{id}?$expand=singleValueExtendedProperties($filter=id eq '{id_value}')
ref https://learn.microsoft.com/en-us/graph/api/singlevaluelegacyextendedproperty-get?view=graph-rest-1.0&tabs=http and https://learn.microsoft.com/en-us/graph/api/resources/post?view=graph-rest-1.0