Forum Discussion
admin_wp21
Nov 17, 2020Copper Contributor
Not able to get individual email content
I'm running into a situation here with the following endpoints -
GET /me/messages
GET /users/{id | userPrincipalName}/messages
I'm able to get the emails between Ben and Admin, but what I need is email content which Ben sent and Admin sent in separated by each user.
I want this -
Ben to Admin - "Hey this is Ben!"
Admin to Ben - "It's Admin here!"
Ben to Admin - "How's it going?"
Instead I'm getting this (real data returned from the api below) -
Ben to Admin -"Hey this is Ben!"
Admin to Ben - "Hey this is Ben! ...... It's Admin here!"
Ben to Admin -"Hey this is Ben! ..... It's Admin here! .... How's it going?"
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('00f7b7b1-6077-4900-9bc0-889654c8c746')/messages(sender,subject,conversationId,body)",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/me/messages?$select=sender%2csubject%2cconversationId%2cbody&$skip=18",
"value": [
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX2o\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEMAADmEIhDnhnqRZnvcZEzDK6eAAFpmeONAAA=",
"subject": "Re: Test Mil 1",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQAJudl_mKeWpCkSbZvolAyUc=",
"body": {
"contentType": "text",
"content": "Ben sent to Admin\r\n________________________________\r\nFrom: admin_wp21 <Admin@wp21.com>\r\nSent: Tuesday, November 10, 2020 4:39 PM\r\nTo: Ben <Ben@WP21.com>\r\nSubject: Test Mil 1\r\n\r\nAdmin sent to Ben\r\n"
},
"sender": {
"emailAddress": {
"name": "Ben",
"address": "Ben@WP21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX2h\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEJAADmEIhDnhnqRZnvcZEzDK6eAAFpmj9_AAA=",
"subject": "Test Mil 1",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQAJudl_mKeWpCkSbZvolAyUc=",
"body": {
"contentType": "text",
"content": "Admin sent to Ben\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX1w\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEKAADmEIhDnhnqRZnvcZEzDK6eAAFpmqNPAAA=",
"subject": "Re: hello ben",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQAMN4p8fjK_ZLneYiecD0SDY=",
"body": {
"contentType": "text",
"content": "\r\n________________________________\r\nFrom: Ben <Ben@WP21.com>\r\nSent: Tuesday, November 10, 2020 4:31 PM\r\nTo: admin_wp21 <Admin@wp21.com>\r\nSubject: Re: hello ben\r\n\r\nHey this is Ben! Hows it going\r\n________________________________\r\nFrom: admin_wp21 <Admin@wp21.com>\r\nSent: Tuesday, November 10, 2020 3:11 PM\r\nTo: Ben <Ben@WP21.com>\r\nSubject: hello ben\r\n\r\nthis is admin\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX1W\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEKAADmEIhDnhnqRZnvcZEzDK6eAAFpmqNMAAA=",
"subject": "Re: hello ben",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQAMN4p8fjK_ZLneYiecD0SDY=",
"body": {
"contentType": "text",
"content": "Hey this is Ben! Hows it going\r\n________________________________\r\nFrom: admin_wp21 <Admin@wp21.com>\r\nSent: Tuesday, November 10, 2020 3:11 PM\r\nTo: Ben <Ben@WP21.com>\r\nSubject: hello ben\r\n\r\nthis is admin\r\n"
},
"sender": {
"emailAddress": {
"name": "Ben",
"address": "Ben@WP21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnXyP\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEJAADmEIhDnhnqRZnvcZEzDK6eAAFpmj97AAA=",
"subject": "hello ben",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQAMN4p8fjK_ZLneYiecD0SDY=",
"body": {
"contentType": "text",
"content": "this is admin\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX1a\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEKAADmEIhDnhnqRZnvcZEzDK6eAAFpmqNNAAA=",
"subject": "Re: asdfasdfasfsa",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQALrPCHkhnPtBruDJXHyZkYY=",
"body": {
"contentType": "text",
"content": "This is test 2\r\n________________________________\r\nFrom: admin_wp21 <Admin@wp21.com>\r\nSent: Monday, November 9, 2020 12:36 PM\r\nTo: admin_wp21 <Admin@wp21.com>\r\nSubject: asdfasdfasfsa\r\n\r\nThis is just a test\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX0d\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEJAADmEIhDnhnqRZnvcZEzDK6eAAFpmj98AAA=",
"subject": "Re: asdfasdfasfsa",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQALrPCHkhnPtBruDJXHyZkYY=",
"body": {
"contentType": "text",
"content": "This is test 2\r\n________________________________\r\nFrom: admin_wp21 <Admin@wp21.com>\r\nSent: Monday, November 9, 2020 12:36 PM\r\nTo: admin_wp21 <Admin@wp21.com>\r\nSubject: asdfasdfasfsa\r\n\r\nThis is just a test\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnXyc\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEKAADmEIhDnhnqRZnvcZEzDK6eAAFpmqNKAAA=",
"subject": "Hey this is from admin@wp21.com!",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQADhokjm4dNZHil2YXWRkHDM=",
"body": {
"contentType": "text",
"content": "Hey Ben C,\r\n\r\nIt's Admin here! I'm testing the email feature of MS.\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX1d\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEKAADmEIhDnhnqRZnvcZEzDK6eAAFpmqNOAAA=",
"subject": "asdfasdfasfsa",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQALrPCHkhnPtBruDJXHyZkYY=",
"body": {
"contentType": "text",
"content": "This is just a test\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
},
{
"@odata.etag": "W/\"CQAAABYAAADmEIhDnhnqRZnvcZEzDK6eAAFpnX0g\"",
"id": "AAMkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQBGAAAAAACEH4GeYthrR5gpFlxfbDDCBwDmEIhDnhnqRZnvcZEzDK6eAAAAAAEJAADmEIhDnhnqRZnvcZEzDK6eAAFpmj99AAA=",
"subject": "asdfasdfasfsa",
"conversationId": "AAQkAGUxOTM0MWE0LTNjNGItNDNjZS1iNDVkLTBlOWU0MWU4MjI5ZQAQALrPCHkhnPtBruDJXHyZkYY=",
"body": {
"contentType": "text",
"content": "This is just a test\r\n"
},
"sender": {
"emailAddress": {
"name": "admin_wp21",
"address": "Admin@wp21.com"
}
}
}
]
}
I would like to do it via an api call, and not need to parse the data.
If the user is replying to a message and quoting the original text, it will be also a part of the new message, so this is by design.
- Victor_IvanidzeBronze Contributor
Hi admin_wp21, you have to parse the message body text to get what you want.