How to send message with attachment to a PPTX document on Teams?

Hi,
I have an integration which uploads a file to the files tab of a channel and then posts to the channel with the file attached. While this works with PNG and PDF files, when I try to attach a PPTX file it errors with the exception File contentUrl extension: '.aspx?sourcedoc=%7B3A6A105C-FC33-4BA2-BD42-663E30AE891A%7D' and name extension: '.pptx' do not match.
This appears to be because the get driveItem is returning a aspx page for the webUrl. e.g. https://{sharepointurl}/sites/{site}/_layouts/15/Doc.aspx?sourcedoc=%7B3A6A105C-FC33-4BA2-BD42-663E30AE891A%7D
The documentation states: 'Note: The file must already be in SharePoint. To find the file properties, GET the driveItem for the file. For example, /drives/{id}/items/{id}. Your attachment ID is the GUID in the eTag of the driveItem, your attachment contentURL is the webUrl of the driveItem's folder plus the driveItem's name, and your attachment name is the driveItem's name.' this is the exact approach I am using. (https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-4-send-a-message-with-file-attachment-in-it)
I am not sure how to get around this issue currently. I have been trying to investigate and get around the issue today with no success. Any guidance?
Thank you, hopefully I will get a response soon form the team-app-dev team
Hi @Daniel Rivers Thanks for reaching out to us. Let us investigate at our end.
DanielRivers-7702 - could you please share the request and response along with response headers? Please remove the access token/ any other personal information.
Sign in to comment