none
Fetching the sent email with SingleValueExtended property in microsoft graph api RRS feed

  • Question

  • While sending an email with microsoft graph api, I include SingleValueExtended property. Once the mail is sent, I want to GET it using the graph api by adding $expand and $filter conditions. Please see the code below.

    {
      "message": {
    "subject": "Meet for lunch?",
    "body": {
      "contentType": "Text",
      "content": "The new cafeteria is open."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "example@domain.com"
        }
      }
    ],
    "ccRecipients": [
      {
        "emailAddress": {
          "address": "example1@domain.com"
        }
      }
    ]
    },
    "saveToSentItems": "true",
      "singleValueExtendedProperties": [
        {
         "id": "String {4F830AA0-48FA-4D11-A5D4-9F6D72FB2A56} Name TestingEmailID",
          "value": "outlookapi-1234"
        }
      ]
    }
    

    I tried to fetch the sent email with the following query.

    https://graph.microsoft.com/beta/me/messages?$expand=singleValueExtendedProperties($filter=id eq 'String {4F830AA0-48FA-4D11-A5D4-9F6D72FB2A56} Name TestingEmailID')&$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'String {4F830AA0-48FA-4D11-A5D4-9F6D72FB2A56} Name TestingEmailID' and ep/value eq 'outlookapi-1234')
    

    It return an empty array. What could be the reason? Any help is appreciated.

    Result :

    { "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('c7b4dae9-babs-4fc3-83n4-19d118617837')/messages", "value": [] }

    My requirement is to get the id of the email that is sent. The sendMail api doesn't return the id of the sent message. Hence trying to send a message with an extended property and fetch it back with this value to access the id. If you have any other suggestion to achieve this requirement, please do let me know.

    Friday, July 19, 2019 5:27 AM

All replies