Issue with a get filesfolder for a teams channel

Dennis Strenkowski 1 Reputation point
2021-06-05T02:57:21.11+00:00

I've written a program using the MS Graph REST API that sends a message to a channel with a file attached to the message using delegated permissions.

It works fine using my Office 365 account and have used it with a couple of customers without issue.

Using it at a new customer, I am getting the following error.
But, I am able to upload a file to the Channel Folder manually in the Teams App without issue.

Attempting to retrieve the Channel Folder for 19:ca8d4ccaaesdgsdfhsdaa40cc9e3b3677c75dc85f@thread.skype
Response Message: Not Found
Caught: java.lang.Exception: Failure getting the Channel Folder: {"error":{"code":"NotFound","message":"
https://mycustomer.sharepoint.com/db905278f90cd6f8c0b9e56bb0da6deb2c6a41cf312ab56b9d319b8c55252545ce3e407/978d84225552125552a37b5248a1926dd7fcf3cb7300a2fd01989ebdf009671400c250
Site isn't available. Attempting to create site : False.","innerError":{"date":"2021-05-28T21:48:31","request-id":"2752264b4d-2031-4d03-962e7-aeb1ccb4617a5","client-request-id":"2752264b4d-2031-4d03-962e7-aeb1ccb4617a5"}}}
java.lang.Exception: Failure getting the Channel Folder: {"error":{"code":"NotFound","message":https://mycustomer.sharepoint.com/db905278f90cd6f8c0b9e56bb0da6deb2c6a41cf312ab56b9d319b8c55252545ce3e407/978d84225552125552a37b5248a1926dd7fcf3cb7300a2fd01989ebdf009671400c250 Site isn't available. Attempting to create site : False.,"innerError":{"date":"2021-05-28T21:48:31","request-id":"27564b4d-2031-4d03-96e7-aeb1cb4617a5","client-request-id":"27564b4d-2031-4d03-96e7-aeb1cb4617a5"}}}

Code Snippet:
Request folderRequest = new Request.Builder()
.url("https://graph.microsoft.com/v1.0/teams/${teamId}/channels/${channelId}/filesFolder")
.method("GET", null)
.addHeader("Authorization", "Bearer ${token}")
.build();
Response response = client.newCall(folderRequest).execute();
println "Response Message: " + response.message();

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,812 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,192 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.