Sep 08 2022 06:31 AM
Trying to post chat message with attachment in teams channel using graph API. We are able to post the message successfully but when try to preview the attachment we are seeing a message please find the screenshot below. Please suggest a way to resolve this issue.
tried request to post using graph call:
POST https://graph.microsoft.com/v1.0/teams/{teamsId}/channels/{channelId}/messages
{
"body": {
"contentType": "html",
"content": "Test with Graph Attachment. <attachment id=\"{eTag}\"></attachment>"
},
"attachments": [
{
"id": "{eTag}",
"contentType": "reference",
"contentUrl": "{SPO Attachment URL}",
"name": "Test Versions.docx"
}
]
}
Sep 08 2022 11:13 PM
Sep 12 2022 01:22 AM
Sep 12 2022 05:03 AM
Sep 12 2022 05:07 AM
Sep 13 2022 11:31 PM
Sep 15 2022 11:46 PM
Sep 16 2022 06:13 AM
@Nivedipa-MSFT - I have tried again as mentioned but still issue remains the same.
Sep 19 2022 02:54 AM
Sep 26 2022 11:23 PM
@Nivedipa-MSFT - I have made the changes that you have suggested, but still the issue persist.
We are trying to access a document from document library in a sub-site.
Would that change the format of the url?
Below are the url's I have tried:
url: https://domainname.sharepoint.com/:x:/r/sites/sharedDocuments/IT.docx
Request body:
{
"body": {
"contentType": "html",
"content": "Sharepoint File Attachment. <attachment id=\"E8D71CE3-1EF1-4301-8D09-2228EC90C605\"></attachment>"
},
"attachments": [
{
"id": "E8D71CE3-1EF1-4301-8D09-2228EC90C605", => Source Id
"contentType": "reference",
"contentUrl": "https://domainname.sharepoint.com/:x:/r/sites/sharedDocuments/IT.docx",
"name": "IT.docx"
}
]
}
Sep 28 2022 11:20 PM
Sep 29 2022 03:14 AM
Oct 02 2022 11:30 PM - edited Oct 02 2022 11:31 PM
@Nivedipa-MSFTAs mentioned in above chat discussion we have tried different forms of SharePoint file path URL but still our issue exist. Please find the document below for different scenario's tried.
Oct 10 2022 10:33 PM
Oct 10 2022 11:36 PM - edited Oct 10 2022 11:40 PM
@Sai06 -
We have tested this API. It was working fine at our end. The attachment has uploaded successfully in channel.
Could you please verify the below points:
1. The file must already be in SharePoint.
2. 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.
Your attachment name is the driveItem's name.
Please let us know if you are facing any further issue?
Oct 11 2022 12:26 AM
@Nivedipa-MSFT - We are able to upload the file successfully to the channel. But the issue is when we are trying to preview the file from the channel.
Please could you confirm that you are able to preview the file from the corresponding channel where its been posted/attached.
Oct 11 2022 02:20 AM
Oct 18 2022 11:49 PM
Oct 26 2022 12:07 AM
Hi Team,
Can you provide me the bug number raised for the above issue?
Nov 30 2022 06:52 AM