microsoft-graph-apimicrosoft-teamsmicrosoft-graph-sdksmicrosoft-graph-teams

How to use the exachangeId in the meetingReference attachment of chatMessageAttachment


I use retrieve-channel-message graph API with application permission, and find the attachment for schedule meeting with channel GET https://graph.microsoft.com/v1.0/teams/``<team-id>/channels/<channel-id>/messages/messages/<message-id>

Here is the attachments part of the response:

...
    },
    "attachments": [
        {
            "id": "1728900287971",
            "contentType": "meetingReference",
            "contentUrl": null,
            "content": "{\"exchangeId\":\"AAMkAGNlMjA0OTUzLTlhODYtNDdkNi1hNmOwLWJiMDYyM2YzMGM5NQBGAAAAAABnlqXEx-W1RbEj5BWXV3vJBwB1ImzHWNJBQYKub9IxqLQwAAAAAAENAAB1ImzHHNJBQYKub9IxqLQwAAAQtNtAAAA=\",\"organizerId\":\"<user-id>\",\"meetingJoinUrl\":\"<meeting-WebJoinUrl>\"}",
            "name": "my scheduled meeting",
            "thumbnailUrl": null,
            "teamsAppId": null
        }
    ],
    "mentions": [],
...

I try to use exchangeId as an event id, but cannot find it: GET https://graph.microsoft.com/v1.0/users/<user-id>/events/AAMkAGNlMjA0OTUzLTlhODYtNDdkNi1hNmOwLWJiMDYyM2YzMGM5NQBGAAAAAABnlqXEx-W1RbEj5BWXV3vJBwB1ImzHWNJBQYKub9IxqLQwAAAAAAENAAB1ImzHHNJBQYKub9IxqLQwAAAQtNtAAAA=

Response:

{
    "error": {
        "code": "ErrorItemNotFound",
        "message": "The specified object was not found in the store."
    }
}

What does exchangeId do and how do I use it? Can anyone help me understand this problem? It would be greatly appreciated.


Solution

  • The ExchangeId in this case would most likely be from the Mailbox associated with Teams its in, particular that Teams Channels calendar. It should be useable if you went via the Groups endpoint for that mailbox associated with the Team the channel is in https://learn.microsoft.com/en-us/graph/api/group-list-events?view=graph-rest-1.0&tabs=http

    The other way of getting it would be to search a users mailbox that was invited based on the meetingJoinUrl. The ExchangeId for a meeting is unique for every attendee that was invited. You can search based on the meetingJoinUrl using the Online meeting endpoint https://learn.microsoft.com/en-us/graph/api/onlinemeeting-get?view=graph-rest-1.0&tabs=http or if you really want to get the calendar item itself you can use the Search Endpoint to search based on the meetingJoinUrl https://learn.microsoft.com/en-us/graph/search-concept-events eg

    {
        "requests": [
            {
                "entityTypes": [
                    "event"
                ],
                "query": {
                    "queryString": "https://teams.microsoft.com/l/meetup-join/19%3ameeting_NzM1MTRmNmItYzk1Zi00YjMyLWE0MTctNzFiZjFiODJhZmMw%40thread.v2/0?context=%7b%22Tid%22%3a%221c3a18bf-da31-4f6c-xxxx-2c06c9cf5ae4%22%2c%22Oid%22%3a%22150bb06c-1c9a-4ac2-8b55-8cf15854b555%22%7d"
                }
            }
        ]
    }

    The Exchange/Graphid will be returned in the hitId which you can the use in the Events endpoint