Using C# GraphClient to get Attachment Contents

  • Thread starter Thread starter williamtholmes
  • Start date Start date
W

williamtholmes

Guest
Hello,

I am trying to retrieve the contents of an email attachment with the MicrosoftGraphServiceClient. Here is the code:

var graphServiceClient = GraphClientFactory.GetGraphServiceClient(config.ClientId, config.Authority, config.Scopes);

MailMessagePage = await graphServiceClient.Me.MailFolders.Inbox.Messages
.Request()
.Expand("attachments")
.GetAsync();

foreach (var mm in MailMessagePage)
{
foreach (var a in mm.Attachments)
{

}
}

The messages are being retrieved just fine along with the attachment meta data. But the Item Property is null. I am obviously missing something. Can someone point me in the correct direction?

Here is an example of a message with at attachment. The attachment object (a) is populated but I don't see the content of the attachment itself. It may need to be retrieved separately using the Id. I have not found documentation on doing so.

1547747.png





Thanks

Continue reading...
 
Back
Top