question

PradipKumbhar-3776 avatar image
0 Votes"
PradipKumbhar-3776 asked RossetLoc-0149 commented

Sorry, this file has been deleted or moved - Teams graph api

Hi All,

I am sending the file to the team's channel by using the team's graph API, by referring to the below document but when clicked on a file in the team's channel getting an error message as "sorry, this file has been deleted or moved."

https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-beta&tabs=http


Below is my code:

Endpoint:
82272-image.png

Body:
82292-image.png


office-teams-app-devmicrosoft-graph-teamwork
image.png (11.3 KiB)
image.png (28.1 KiB)
image.png (11.3 KiB)
image.png (28.1 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PradipKumbhar-3776,
As we are mainly responsible for general question of Microsoft Teams, your question related to development is not in our scope. I will change office-teams-windows-itpro tag to office-teams-app-dev tag. Thanks for your understanding.

1 Vote 1 ·

Hi @PradipKumbhar-3776, Are you getting any error message in graph explorer response body. If yes, please share error message details.

0 Votes 0 ·

@Mamatha-MSFT : The file is getting uploaded to teams channel but when I click on the file in team's channel it's showing an error message on teams, not in graph explorer, PFA screenshot for the reference.


82630-screenshot-2021-03-30-at-20813-pm.png


82731-screenshot-2021-03-30-at-21109-pm.png


0 Votes 0 ·

Could you please check are you using the uploaded file url in share point? Also check the exists in the channel or it is deleted?

0 Votes 0 ·

1 Answer

PradipKumbhar-3776 avatar image
0 Votes"
PradipKumbhar-3776 answered RossetLoc-0149 commented

Hi All,

Finally, I am able to figure out the issue, there was an issue with View ID and Content URL.

The vieweId should be documented source ID, it will be visible in browser with the label "sourcedoc".

In the case of the root site, we need to provide /:x:/r/ in addition to the file path


Correct URL Path:
https://nowlabcorp.sharepoint.com/:x:/r/Shared%20Documents/report.csv

· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

I have the same problem as you had and I am trying to figure out how to implement your solution. Could you please precise what you changed to the body of your request ?

What do you mean by "viewID" and "sourceID" ? Did you get the file opening in Teams by changing the id field in your request by another eTag ?

0 Votes 0 ·

Hi,


As per the below code from Microsoft docs, the attachment id needs to be provided correctly, you will find this id when you open your file from SharePoint, in-browser URL you will find it with the label "sourcedoc". "Attachment id" is nothing but "sourcedoc"


{
"body": {
"contentType": "html",
"content": "Here's the latest budget. <attachment id=\"153fa47d-18c9-4179-be08-9879815a9f90\"></attachment>"
},
"attachments": [
{
"id": "153fa47d-18c9-4179-be08-9879815a9f90",
"contentType": "reference",
"contentUrl": "https://m365x987948.sharepoint.com/sites/test/Shared%20Documents/General/test%20doc.docx",
"name": "Budget.docx"
}
]
}

1 Vote 1 ·

Ok thank you, I understand now.

Unfortunately, I can't use this solution for my problem. My file is actually an attachment to a sharepoint item and I can't display it in the browser neither in teams. However if I access the url of the file, it downloads it.

I am not sure how to make it "displayable"

0 Votes 0 ·
Show more comments