From 93f2c13485fb755e742cfb8e8e05153ba16f0ac4 Mon Sep 17 00:00:00 2001 From: fnuhs Date: Thu, 2 Mar 2023 12:42:35 +0100 Subject: [PATCH 1/2] Update GraphSender.cs Set missing FileAttachement and AttachementItem properties from Core.Models.Attachment --- src/FluentEmail.Graph/GraphSender.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/FluentEmail.Graph/GraphSender.cs b/src/FluentEmail.Graph/GraphSender.cs index e1f4d4d..1d86120 100644 --- a/src/FluentEmail.Graph/GraphSender.cs +++ b/src/FluentEmail.Graph/GraphSender.cs @@ -130,7 +130,14 @@ private async Task UploadAttachmentUnder3Mb(IFluentEmail email, Message draft, C { var attachment = new FileAttachment { - Name = a.Filename, ContentType = a.ContentType, ContentBytes = GetAttachmentBytes(a.Data), + Name = a.Filename, + ContentType = a.ContentType, + ContentBytes = GetAttachmentBytes(a.Data), + ContentId = a.ContentId, + IsInline = a.IsInline, + + // can never be bigger than 3MB, so it is save to cast to int + Size = (int)a.Data.Length, }; await this.graphClient.Users[email.Data.FromAddress.EmailAddress] @@ -146,7 +153,12 @@ private async Task UploadAttachment3MbOrOver( { var attachmentItem = new AttachmentItem { - AttachmentType = AttachmentType.File, Name = attachment.Filename, Size = attachment.Data.Length, + AttachmentType = AttachmentType.File, + Name = attachment.Filename, + Size = attachment.Data.Length, + ContentType = attachment.ContentType, + ContentId = attachment.ContentId, + IsInline = attachment.IsInline, }; var uploadSession = await this.graphClient.Users[email.Data.FromAddress.EmailAddress] From bd10666fc4a6953571b8f1e47f2e73db1640ed9d Mon Sep 17 00:00:00 2001 From: fnuhs <60214327+fnuhs@users.noreply.github.com> Date: Mon, 6 Mar 2023 07:56:36 +0100 Subject: [PATCH 2/2] Fixed typo in GraphSender.cs --- src/FluentEmail.Graph/GraphSender.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FluentEmail.Graph/GraphSender.cs b/src/FluentEmail.Graph/GraphSender.cs index 1d86120..4a5d298 100644 --- a/src/FluentEmail.Graph/GraphSender.cs +++ b/src/FluentEmail.Graph/GraphSender.cs @@ -136,7 +136,7 @@ private async Task UploadAttachmentUnder3Mb(IFluentEmail email, Message draft, C ContentId = a.ContentId, IsInline = a.IsInline, - // can never be bigger than 3MB, so it is save to cast to int + // can never be bigger than 3MB, so it is safe to cast to int Size = (int)a.Data.Length, };