Forum Discussion
shuheitagawa
Mar 16, 2024Copper Contributor
Issue with GraphAPI Uploads to Teams-Associated SharePoint and Viewer Error
Issue: It is possible to upload files to SharePoint associated with Teams using GraphAPI, and it can be uploaded to a folder associated with the team. When attaching a file via GraphAPI to post in...
ChetanSharma-msft
Microsoft
Mar 18, 2024Hello shuheitagawa - Thanks for raising your query.
We will look into it and let you know the updates.
We will look into it and let you know the updates.
shuheitagawa
Mar 19, 2024Copper Contributor
Hello, do you have any updates on this?
We build the application which works with Microsoft-Teams and this problem is critical issue for us.
Thank you in advance.
We build the application which works with Microsoft-Teams and this problem is critical issue for us.
Thank you in advance.
- Meghana-MSFTMar 20, 2024Bronze ContributorWe are checking this internally, we will get back to you.
- Meghana-MSFTMar 21, 2024Bronze ContributorWe can only repro this experience if an incorrect etag for the share point file is used.
We are able to preview the file as expected with correct etag.
Can you please confirm if you are using the correct etag as file attachment id.- shuheitagawa-deiliveMar 22, 2024Copper Contributor
Hello.
I still have a problem with it.After uploading to the share point, we can get DriveItem resource from GraphAPI which has `eTag` property.
https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0As a next step, we want to send message to Teams with attachments.
We were following the example above.
Example 3: Send a message containing cards
https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-3-send-a-message-containing-card
We generated unique uuid by ourselves and add it to the id property with request.
I also checked that I added `eTag` associated with DriveItem to the id property but it didn't work.POST https://graph.microsoft.com/v1.0/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/19:4a95f7d8db4c4e7fae857bcebe0623e6@thread.tacv2/messages Content-type: application/json { "subject": null, "body": { "contentType": "html", "content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>" }, "attachments": [ { "id": "74d20c7f34aa4a7fb74e2b30004247c5", "contentType": "application/vnd.microsoft.card.thumbnail", "contentUrl": null, "content": "{\r\n \"title\": \"This is an example of posting a card\",\r\n \"subtitle\": \"<h3>This is the subtitle</h3>\",\r\n \"text\": \"Here is some body text. <br>\\r\\nAnd a <a href=\\\"http://microsoft.com/\\\">hyperlink</a>. <br>\\r\\nAnd below that is some buttons:\",\r\n \"buttons\": [\r\n {\r\n \"type\": \"messageBack\",\r\n \"title\": \"Login to FakeBot\",\r\n \"text\": \"login\",\r\n \"displayText\": \"login\",\r\n \"value\": \"login\"\r\n }\r\n ]\r\n}", "name": null, "thumbnailUrl": null } ] }