Are you looking for a ready to use code or? Generally speaking, you use the /messages/{item-id}/attachments/{attach-id}/$value endpoint, as detailed here: https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http
Download Item Attchment using Graph client API
Natrix De
1
Reputation point
How Can I download item attachment using graph client API in my .NET core app?
2 answers
Sort by: Most helpful
-
-
Deva-MSFT 2,266 Reputation points Microsoft Employee
2020-10-31T20:01:25.957+00:00 With MS Graph Explorer i would try like this:
https://graph.microsoft.com/v1.0/me/messages/AAMkAGRlNWM4Njk4LWY3NTYtNGE2MC05ZjQzLTg1YmM5YjIzNTRhMwBGAAAAAAA-L78mmzKFQ7FpvCcWkAziBwCUgufVfU8cSKxkYzIkrl81AAAAAAEMAACUgufVfU8cSKxkYzIkrl81AACPpiPUAAA=/attachments/AAMkAGRlNWM4Njk4LWY3NTYtNGE2MC05ZjQzLTg1YmM5YjIzNTRhMwBGAAAAAAA-L78mmzKFQ7FpvCcWkAziBwCUgufVfU8cSKxkYzIkrl81AAAAAAEMAACUgufVfU8cSKxkYzIkrl81AACPpiPUAAABEgAQAHuvC2KF7iBGiNpH9HGIZ8k=/
If it's GraphClient i would try like this (adding the code sample):
GraphServiceClient graphClient = new GraphServiceClient( authProvider ); var attachment = await graphClient.Me.Messages["AAMkAGRlNWM4Njk4LWY3NTYtNGE2MC05ZjQzLTg1YmM5YjIzNTRhMwBGAAAAAAA-L78mmzKFQ7FpvCcWkAziBwCUgufVfU8cSKxkYzIkrl81AAAAAAEMAACUgufVfU8cSKxkYzIkrl81AACPpiPUAAA="].Attachments["AAMkAGRlNWM4Njk4LWY3NTYtNGE2MC05ZjQzLTg1YmM5YjIzNTRhMwBGAAAAAAA-L78mmzKFQ7FpvCcWkAziBwCUgufVfU8cSKxkYzIkrl81AAAAAAEMAACUgufVfU8cSKxkYzIkrl81AACPpiPUAAABEgAQAHuvC2KF7iBGiNpH9HGIZ8k="] .Request() .GetAsync();
Result:
This will get me the content byte from the item attachment (adding a snapshot):Hope this helps.