public async Task <string> StoreMimeMessage([FromBody] MimeMail request) { string[] graphScopes = { "https://graph.microsoft.com/Mail.Read", "https://graph.microsoft.com/Files.ReadWrite" }; string accessToken = await GetAccessToken(graphScopes); Stream mimeContent = await GetMime(accessToken, request.MessageID); string webUrl = await uploadMail2OD(accessToken, mimeContent, "Testmail.eml"); return(webUrl); }
public async Task <IMessageAttachmentsCollectionPage> GetAttachments([FromBody] MimeMail request) { string[] graphScopes = { "https://graph.microsoft.com/Mail.Read", "https://graph.microsoft.com/Files.ReadWrite" }; string accessToken = await GetAccessToken(graphScopes); GraphServiceClient graphClient = new GraphServiceClient(new DelegateAuthenticationProvider( async(requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken); })); var attachments = await graphClient.Me.Messages[request.MessageID] .Attachments .Request() .GetAsync(); return(attachments); }