Hi @eggy mcegg ,
Great to know that and thanks for sharing the update here.
By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others.". and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:
[How to download OneDrive/SharePoint attachments off messages (email) using Graph API?]
Issue Symptom:
I have a requirement where I have to download the content that is attached to the emails in my organization.
Scenarios include
- when a user is on OneDrive/Sharepoint and they go to share a file via email. A 'sent' email gets generated in said users emails.
- when a user is on Outlook -> New message -> Attach file -> OneDrive -> Send. A 'sent' email gets generated in said users emails.
I can access these emails, but the problem is I am unable to download the actual content. For instance the attachments endpoint (when I share via OneDrive):
https://graph.microsoft.com/v1.0/users/{user-id}/messages/{msg-id}/attachments
Returns the actual attachments on the email (i.e. images). I am able to extract a href off the body content but I do not know how to download the content that is linked? i.e.
https://sharepoint-my.sharepoint.com/:x:/g/personal/administrator/<id?>>?e=4%3a0uILKI&at=9\
When I attach when a new email is created:
https://sharepoint.sharepoint.com/:w:/t/TestTree/<id?>
Again I don't know how to download the content that is being linked in the href.
Any idea how I can do this guys? Thanks
Current status:
Ok I managed to find a solution by using shared links
https://learn.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=http
You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community members to see the useful information when reading this thread. Thanks for your understanding!