question

AleksandrYushko-7934 avatar image
0 Votes"
AleksandrYushko-7934 asked ·

Get Attachment photo/video/file from conversation by attachment id or contentUrl

Hi All! Need Help!
We tried to receive attachment file when send conversation to other side but can't do it.
attempt 1(with graph client):
graphClient.me().messages("1614078832901").attachments("b7c5fd22-8b53-4528-8fe3-5d600471eeb8").buildRequest().get();
response status: 403.

attempt 2 (with Postman):
https://graph.microsoft.com/beta/me/messages/1614078832901/attachments/b7c5fd22-8b53-4528-8fe3-5d600471eeb8
Authorization Bearer {token}
response status: 403.

attempt 3 (with contentUrl):
https://dataart618.sharepoint.com/sites/test03/Shared Documents/General/a3411_lg.jpg
Authorization Bearer {token}
response status: 401.

All permissions was added from this doc: https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http#example-9-get-the-mime-raw-contents-of-a-meeting-invitation-item-attachment-on-a-message

I read that your SDK did not support this functionality earlier. Is it possible now to get the attached file somehow? If not, when do you plan to implement this feature?

Thanks a lot!

microsoft-graph-sdkmicrosoft-graph-mail
· 1
10 |1000 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 @AleksandrYushko-7934

Our forum is focused on Microsoft Teams general issue. According to your description, your issue is more related to development, which we do not support. I will remove teams tag and add team-dev tag here. Thanks for your understanding and patience!

1 Vote 1 ·
Mamatha-MSFT avatar image
0 Votes"
Mamatha-MSFT answered ·

Hi @AleksandrYushko-7934, I tried to repro at my end using Graph API request it's working fine and I am getting attachment properties.

GET https://graph.microsoft.com/v1.0/me/messages/{id}/attachments/{id}

Could you please try again by giving correct Message Id and attachment Id.

·
10 |1000 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.

AleksandrYushko-7934 avatar image
0 Votes"
AleksandrYushko-7934 answered ·

Hi, @Mamatha-MSFT .
Are you tried to get attachments from Microsoft Teams?
If yes, can you describe steps for getting attachment files and needed permissions?
This API doesn't work for me:

73165-photo-2021-03-01-23-17-35.jpg


73119-photo-2021-03-01-23-20-15.jpg



· 3 ·
10 |1000 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.

@AleksandrYushko-7934, In teams channel you can get Message details and the response body containing contentUrl. You can use contentUrl to display message, But It's not possible to get attachment directly.


0 Votes 0 ·

@Mamatha-MSFT I wrote about contentUrl in my question, thanks.
But it doesn't work for getting attached file using graph api or http request. For example:

GET: https://dataart618.sharepoint.com/sites/test03/Shared Documents/General/a3411_lg.jpg
Headers: Authorization Bearer {token}
Response: 401 Unauthorised

Do you know how to do it? If it is not possible now, will such a possibility be improved in the future?
Thanks.

0 Votes 0 ·
Mamatha-MSFT avatar image Mamatha-MSFT AleksandrYushko-7934 ·

It is not possible to get attached file using graph Api. Microsoft will always focus on customer’s feedback and experience, some new features would be added to the services based on customers' feedback in the future, we also recommend you give your new idea in Teams UserVoice here.


0 Votes 0 ·