Forum Discussion
Unable to download teams channel pasted image
Hi everyone,
I got a composeExtension/fetchTask payload from messaging extension in teams channel.
here is the messagePayload body
{
"contentType": "html",
"content": "<p><img itemscope=\"png\" itemtype=\"http://schema.skype.com/AMSImage\" src=\"https://ca-prod.asyncgw.teams.microsoft.com/v1/objects/0-eca-d2-82060272c88cde4d9878dd71225698c5/views/imgo\" width=\"213\" height=\"164\" alt=\"image\" id=\"x_0-eca-d2-82060272c88cde4d9878dd71225698c5\" itemid=\"0-eca-d2-82060272c88cde4d9878dd71225698c5\"></p>\r\n<p>12313</p>"
}
for the img https://ca-prod.asyncgw.teams.microsoft.com/v1/objects/0-eca-d2-82060272c88cde4d9878dd71225698c5/views/imgo, I cannot download it in server side.
I tried to use graph API token,
and the token from await new MicrosoftAppCredentials("bot id", "bot serect").GetTokenAsync();
both of them getting 401 error.
could anyone help?
Best regards.
David
- Sayali-MSFTMicrosoft
@David_Chan2255-Thank you for your inquiry about your Teams app development issue! To assist you better, could you please provide the following details?
1.Please share the steps you took to encounter the issue.
2.Any specific documentation you followed that relates to your problem.
This information will help us better understand the situation and provide a more accurate response.
Also, ensure that the token you are using is valid and has not expired. Tokens typically have a limited lifespan, and using an expired token will result in a 401 error. - David_Chan2255Copper Contributor
1.Please share the steps you took to encounter the issue.
1. post a message with copy and pasted image to teams channel
2. right click on the message a select an action with an extension created
3. Teams bot send a POST request with composeExtension/fetchTask to our API
4. in the API, we get the URL of that image
5. try to download it with token.2.Any specific documentation you followed that relates to your problem.
no.
- Sayali-MSFTMicrosoft
Hello David_Chan2255, Thank you for your report! We are currently unable to reproduce the issue you’re experiencing. Could you please provide the following information to help us better assist you?
- Please confirm the version of Teams you are using when encountering this issue.
- please share any relevant code snippets and manifest Json.
This information will be invaluable in helping us understand the problem and find a solution.
- David_Chan2255Copper Contributor
Hello Sayali-MSFT,
thank you for the reply.
- Please confirm the version of Teams you are using when encountering this issue.
I am using Teams in web, I think that is the latest version.
- please share any relevant code snippets and manifest Json.
manifest JSON:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.12/MicrosoftTeams.schema.json",
"version": "1.0.0",
"manifestVersion": "1.12",
"id": "6310e..aa72c23",
"name": {
"short": "Maximizer dot net www2",
"full": "Maximizer CRM Messaging dot net www2 Extension"
},
"developer": {
"name": "Maximizer",
"mpnId": "1..0",
"websiteUrl": "https://maximizer.com",
"privacyUrl": "https://www.maximizer.com/about-us/privacy-policy/",
"termsOfUseUrl": "https://www.maximizer.com/about-us/terms-of-use/"
},
"description": {
"short": "Boost sales productivity by quickly accessing and sharing key CRM data in chats.",
"full": "**Unlock the Full Potential of Your Sales Team with Maximizer's Messaging Extension for Microsoft Teams.**\r\n \r\nDesigned to streamline collaboration, this app allows users to quickly search for and share key CRM data, such as contacts, opportunities, cases, and leads, directly within Teams conversations. By bringing CRM data into your chat feed, you can make faster, informed decisions and keep your team aligned without leaving Teams.\r\n \r\n**Key Features:**\r\n \r\n- **Instant CRM Search:** Easily search and retrieve Address Book entries, Opportunities, Leads, and Cases directly within Teams.\r\n- **Seamless CRM Data Sharing:** Share Maximizer entries in Teams conversations so that your colleagues can access key information without switching apps.\r\n- **Quick CRM Data Access:** Open original Maximizer records from the contact cards shared with you in Teams.\r\n- **Effortless Communication Capture:** Save important chat messages and attachments to contacts, leads, opportunities, and cases in Maximizer.\r\n \r\nTo access the features of this app, a Maximizer subscription is required. To get started, please contact Maximizer to set up a trial account, or reach out to your Maximizer administrator for a license. For more information on purchasing a subscription, visit [Maximizer Website](https://www.maximizer.com/book-a-demo/) or contact support at [email address removed for privacy reasons](mailto:email address removed for privacy reasons)."
},
"icons": {
"outline": "outline.png",
"color": "color.png"
},
"accentColor": "#cdea1e",
"staticTabs": [
],
"composeExtensions": [
{
"botId": "f4593....a72d",
"commands": [
{
"id": "SaveMsg",
"type": "action",
"title": "Save to Maximizer",
"description": "Save to Maximizer",
"initialRun": false,
"fetchTask": true,
"context": [
"message"
],
"parameters": [
{
"name": "param",
"title": "param",
"description": "param",
"inputType": "Text",
"choices": []
}
]
}
],
"canUpdateConfiguration": false
}
],
"validDomains": [
"www.maximizer.com"
]
}
request payload from teams bot
{
"name": "composeExtension/fetchTask",
"type": "invoke",
"timestamp": "2024-11-15T05:57:45.317Z",
"localTimestamp": "2024-11-15T13:57:45.317+08:00",
"id": "f:0cede953-d6e6-786f-552e-e738c1f14677",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/ca/94b4884d-1dcf-4749-be8f-b3389397442b/",
"from": {
"id": "29:1eF0-vh4wgXY8RnFlamf4Q5jznu4BXVIh54nmwmLUQtSFcXge_jAt6ix_Zw3sagvbCLqqPJH7tpbxF3l1f1oN3Q",
"name": "David Chan",
"aadObjectId": "393b9500-1b76-4a83-a6cf-8b92bd5201a7"
},
"conversation": {
"isGroup": true,
"conversationType": "channel",
"tenantId": "94b4884d-1dcf-4749-be8f-b3389397442b",
"id": "19:qRth1o0KEf5ocyb2MXSiNTtE8gqFKoCCwKpi9I2sgZs1@thread.tacv2;messageid=1730769249935"
},
"recipient": {
"id": "28:f4593a6a-e609-4e62-bb44-1b3cf61ea72d",
"name": "msTeamsExtensionDotNetCoreWww2"
},
"entities": [
{
"locale": "en-US",
"country": "US",
"platform": "Web",
"timezone": "Asia/Hong_Kong",
"type": "clientInfo"
}
],
"channelData": {
"channel": {
"id": "19:qRth1o0KEf5ocyb2MXSiNTtE8gqFKoCCwKpi9I2sgZs1@thread.tacv2"
},
"team": {
"id": "19:qRth1o0KEf5ocyb2MXSiNTtE8gqFKoCCwKpi9I2sgZs1@thread.tacv2"
},
"tenant": {
"id": "94b4884d-1dcf-4749-be8f-b3389397442b"
},
"source": {
"name": "compose"
}
},
"value": {
"commandId": "SaveMsg",
"commandContext": "message",
"context": {
"theme": "default"
},
"messagePayload": {
"id": "1731310755026",
"replyToId": "1730769249935",
"createdDateTime": "2024-11-11T07:39:15.026Z",
"deleted": false,
"importance": "normal",
"locale": "en-us",
"from": {
"user": {
"userIdentityType": "aadUser",
"id": "393b9500-1b76-4a83-a6cf-8b92bd5201a7",
"displayName": "David Chan"
}
},
"body": {
"contentType": "html",
"content": "<p><img itemscope=\"png\" itemtype=\"http://schema.skype.com/AMSImage\" src=\"https://ca-prod.asyncgw.teams.microsoft.com/v1/objects/0-eca-d2-82060272c88cde4d9878dd71225698c5/views/imgo\" width=\"213\" height=\"164\" alt=\"image\" id=\"x_0-eca-d2-82060272c88cde4d9878dd71225698c5\" itemid=\"0-eca-d2-82060272c88cde4d9878dd71225698c5\"></p>\r\n<p>12313</p>"
},
"attachments": [],
"mentions": [],
"reactions": [],
"linkToMessage": "https://teams.microsoft.com/l/message/19:qRth1o0KEf5ocyb2MXSiNTtE8gqFKoCCwKpi9I2sgZs1@thread.tacv2/1731310755026?parentMessageId=1730769249935"
}
},
"locale": "en-US",
"localTimezone": "Asia/Hong_Kong"
}
- worknetbeamCopper Contributor
Fixes to Try
1. Save the Image Locally Before Uploading
- Instead of pasting directly into Teams, save the image to your computer (e.g., using Paint or a similar tool) and then upload it to the channel.
2. Clear Teams Cache
- Steps to clear the cache:
- Completely close Microsoft Teams.https://thetocaworld.com/
- David_Chan2255Copper Contributor
Hi worknetbeam
thank you for the suggestion.
But we are implementing an extension for save message to our server, the downloading image in client side is working only if the user using web version.
but in mobile or desktop version, we are getting no permission error when try to download the image.