Reputation: 1175
I have read the following article. How to get MIME content of Office365 mail using Microsoft Graph API?
Yes we can get the mime value using REST call. However, my requirement is getting the MIME using .net core Microsoft.Graph SDK.
I can easily get the Message using the following code in the shape of IMailFolderMessagesCollectionPage. But what I need is in the MIME shape/ EML
graphClient.Users[userEmailAddress].MailFolders[folderNameId].Messages.Request().GetAsync()
However, I am unable to find any method in the Graph API SDK C# to get any MIME content. Any advices? Thanks.
Upvotes: 0
Views: 1307
Reputation: 3575
I have tested in POSTMAN and Graph Explorer and I was able to get the MIME content in them as shown below.
Looks like the Content
is not present in SDK yet but you can use the below code to get the MIME content.
var request = graphClient.Me.Messages["AAMkAGI0Mjk2NTQ5LTE4MjctNDE1Yy04Nzc0LWIxNzA0MDBkNDkwZABGAAAAAABAJhtsoNeXR49KeByGVNbsBwB0tR3-uC1cSqrKkE00IGLeAAAAAAEMAAB0tR3-uC1cSqrKkE00IGLeAADHJTf8AAA="].Request()
.GetHttpRequestMessage();
request.RequestUri = new Uri(request.RequestUri.OriginalString + "/$value");
var response = await graphClient.HttpProvider.SendAsync(request);
var message = await response.Content.ReadAsStringAsync();
Console.WriteLine(message);
You can see the content as below.
I have referred the code from here.
Upvotes: 1