Forum Discussion
Can't Get Files of channels from team using graph api
Hi,
I've an Oauth App created in AAD thorough which i can access teams, channels and channels messages including attachments but not getting attachment content using the same token.
following as an example attachment url which i get from teams/{teamid}/channels/{channelid}/messages
but
when i try https://{mysubdomain}.sharepoint.com/sites/Public/Shared%20Documents/General/file.txt
it return 401 Unauthorized
following permissions are already given to the app.
Files.Read.All
Files.Read
ChannelMessage.Read.All
Please Guide on how to get the attachment using graph api.
- Nikitha-MSFTMicrosoft
hidayat3676 _ You can send an attachment to teams, the file is saved in the share point, which you can view in the files folder of the team, You can get the file details and URL to the file in share-point using . But you cannot get the content of file using Graph API. Please check get filesfolder to get file
- hidayat3676Copper ContributorNikitha-MSFT The link you mentioned just return the folder path, I'm interested to get files and it's content can you please refer me to the doc for it. As you mentioned it's not possible using graph then how can i access the file content as there any other api exists for it or it is not possible to access it using api at all?
- Nikitha-MSFTMicrosoftCould you please check [this](https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http#example-6-get-the-raw-contents-of-a-file-attachment-on-a-message) try if that helps