I am able to get the attachment info of the MSTeam chat using following beta version API https://graph.microsoft.com/beta/teams/{group-id-for-teams}/channels/{channel-id}/messages/{message-id}/replies/{reply-message-id}
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('e7884ec9-cbf3-4661-b74a-6fc42ac34ce1')/channels('19%3A6a04c17090e249319b3731cbe72e6085%40thread.tacv2')/messages('1600060770982')/replies/$entity",
"id": "1600061187436",
"replyToId": "1600060770982",
"etag": "1600061187436",
.....
"attachments": [
{
"id": "40ce4e84-6e47-43ed-acb9-9edcddff5ef4",
"contentType": "reference",
"contentUrl": "https://.......1/Shared Documents/General/MsteamchatHistory Documentation.docx",
"content": null,
"name": "MsteamchatHistory Documentation.docx",
"thumbnailUrl": null
}
],
......
}
Not able to download using ContentUrl, hence finding the ways to get downloadURL so that it can be downloaded using HttpWebRequest.
One way to get download URL is by using https://graph.microsoft.com/v1.0/groups/{group-id-for-teams}/drive/items/{item-id}
which gives
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups('e7884ec9-cbf3-4661-b74a-6fc42ac34ce1')/drive/items/$entity",
"@microsoft.graph.downloadUrl": "https://nepa1.sharepoint.com/sites/Venio1/_layouts/15/download.aspx?UniqueId=40ce....0&ApiVersion=2.0",
"createdDateTime": "2020-09-14T05:26:14Z",
"eTag": "\"{40CE4E84-6E47-43ED-ACB9-9EDCDDFF5EF4},2\"",
"id": "012PWSBOUEJ3HEAR3O5VB2ZOM63TO76XXU",
"lastModifiedDateTime": "2020-09-14T05:26:21Z",
"name": "MsteamchatHistory Documentation.docx",
"webUrl": "https://nepa1.sharepoint.com/sites/Venio1/_layouts/15/Doc.aspx?sourcedoc=%7B40CE4E84-6E47-43ED-ACB9-9EDCDDFF5EF4%7D&file=MsteamchatHistory%20Documentation.docx&action=default&mobileredirect=true",
"cTag": "\"c:{40CE4E84-6E47-43ED-ACB9-9EDCDDFF5EF4},3\"",
"size": 563211,
.....
}
Here I found the item-id by exploring groups. But I want the find the item id from the respective attachment id so that I can get the download URL for that attachment and used it to download using HttpWebRequest.
So, Is it possible to get the drive item-id from the attachment id? If yes, how can it be done?
Thanks in advance.