SOLVED

Get file content (attachment like docx, png,...) of a message in Teams with message extension action

Copper Contributor

Hi

Is it possible to select a message in Teams and get the file content of the attachment to store it in a database with a message extension action?

If I select the action on message->more actions, I got an answer in the bot (OnTeamsMessagingExtensionSubmitActionAsync). But, how can I get the message information and file content from that point?

Thanks for your help.

Cheers Harald

5 Replies
best response confirmed by Christopher Hoard (MVP)
Solution

Hi @hthoenig

See Github thread here

https://github.com/MicrosoftDocs/msteams-docs/issues/2021

Currently file download is not supported through message extension. when you receive an ME payload, it stores the file in different location which is currently not downloadable.

Uservoice is here:

https://microsoftteams.uservoice.com/forums/555103-public/suggestions/41607805-messaging-extension-f...

Would recommend voting it up and adding to the Github thread to see where the team is at. At the moment, from current voting and responses on Github doesn't look like an ETA is there yet

Hope that answers your question

Best, Chris

Thanks Chris

Hope this feature will be provided soon.

Cheers Harald

Hi Chris
Is there another way to download these files within messaging extensions? Mybe with Graph? I tried it with
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var driveItem = await graphClient.Shares["{sharedDriveItem-id}"].DriveItem
.Request()
.GetAsync();
But it does not work. I get always an error.
Any idea?
Cheers Harald
This article insinuates that they should be able to be downloaded

https://github.com/MicrosoftDocs/msteams-docs/issues/2021

See this paragraph

My solution was to add an extra layer of authentication to the MsGraph api and use that to query for the attachments in OneDrive/Sharepoint. By way of extra api pulls for the team id and the drive id, I do eventually get to an endpoint that returns a downloadUrl property which allows me to download the files. Personally, I think it's cool that such a solution is possible via Graph and honestly it seems to be working decently well (aside from the timeout problem and path-based search uncertainty). However, it also seems less-reliable and unnecessarily circuitous.

I would comment on Github and reach out to the user who should be able to direct how to do that

Best, Chris
1 best response

Accepted Solutions
best response confirmed by Christopher Hoard (MVP)
Solution

Hi @hthoenig

See Github thread here

https://github.com/MicrosoftDocs/msteams-docs/issues/2021

Currently file download is not supported through message extension. when you receive an ME payload, it stores the file in different location which is currently not downloadable.

Uservoice is here:

https://microsoftteams.uservoice.com/forums/555103-public/suggestions/41607805-messaging-extension-f...

Would recommend voting it up and adding to the Github thread to see where the team is at. At the moment, from current voting and responses on Github doesn't look like an ETA is there yet

Hope that answers your question

Best, Chris

View solution in original post