Closed Junlol closed 4 days ago
@Junlol - Thanks for raising your issue. Could you please more details on your issue? Any sample code reference or repro step would be really helpful.
When a file is uploaded from the iOS Teams app, my bot receives the following activity:
{
"attachments": [
{
"contentType": "application/vnd.microsoft.teams.file.download.info",
"content": {
"downloadUrl": "https://{xxx}.sharepoint.com/:i:/g/personal/{user id}/EYppPe...N4p9A",
"uniqueId": "...",
"fileType": "png"
},
"contentUrl": "https://{xxx}.sharepoint.com/:i:/g/personal/{user id}/EYppPe...N4p9A",
"name": "file 1.png"
}
],
}
This image was shared from onedrive, contentUrl and downloadUrl are the same
Unfortunately, my bot cannot directly download files from URLs like this one.
I hope that my bot can retrieve files using an HTTP client(Axios).
When I open this URL in a browser, it leads to a OneDrive webpage rather than directly accessing a file.
Thanks for sharing these details. We will check this from our side and will update you shortly.
Hi @Junlol - We tried to repro this issue. Using Teams Desktop/Web app, we were able to upload file, but using mobile devices (Android/iOS) sadly we could not get any option to upload/attach any file in bot chat.
Could you please let us know how did you upload the file?
I'm not sure why my bot can accept uploading attachments. If I upload media, it works fine.
When I use Teams Web App and Teams Android App to share onedrive files, the activity has missing attachments or the attachments content does not have a downloadUrl.
{
"attachments": [
{
"contentType": "text/html",
"content": ""
}
]
}
@Junlol , when we upload file from Teams desktop/web client, the content-type is text/html
which doesn't align with the one you got which was stream
content-type.
"attachments": [
{
"contentType": "application/vnd.microsoft.teams.file.download.info",
"content": {
"downloadUrl": "https://{xxx}.sharepoint.com/personal/{user id}/_layouts/15/download.aspx?UniqueId={...}&Translate=false&tempauth={token}",
"uniqueId": "xxxxxx-xxxx-xxxx-xxxxxxxx",
"fileType": "gif"
},
"contentUrl": "https://{xxx}.sharepoint.com/personal/{user id}/Documents/DemoVideo.gif",
"name": "DemoVideo.gif"
},
{
"contentType": "text/html",
"content": ""
}
],
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 3 days of this comment.
When uploading files via Teams on Windows, the bot can directly download the content from a downloadUrl with the stream content-type.
"downloadUrl": "https://{xxx}.sharepoint.com/personal/{user id}/_layouts/15/download.aspx?UniqueId={...}&Translate=false&tempauth={token}"
However, when using iOS Teams app uploading files, the downloadUrl content-type is text/html.
"downloadUrl": "https://{xxx}.sharepoint.com/:i:/g/personal/{user id}/EYppPe...N4p9A"
How do I download the file directly from URL above?