Importing EML file to Group Mailbox (Unified Groups)

Copper Contributor


We importing mails from user mailbox to Group Mailbox.
Everything works fine except when we importing mail from user SENT POST folder.
Imported mails in Group Mail getting wrong display datetime.
DateTime for imported mail is import DateTime not mail dateTime.


var mailStream = await graphClient.Me.Messages[MailID].Content.Request().GetAsync()
var ewsClient = new ExchangeService();
Mailbox _Mailbox = new Mailbox(GroupSmtpAddress);
FolderId _Inbox = new FolderId(WellKnownFolderName.Inbox, _Mailbox);
Folder _Folder = await Folder.Bind(ewsClient, _Inbox);

EmailMessage email = new EmailMessage(ewsClient);


mailStream.Seek(0, SeekOrigin.Begin);
byte[] mime = new byte[mailStream.Length];
await mailStream.ReadAsync(mime, 0, (int)mailStream.Length);
email.MimeContent = new Microsoft.Exchange.WebServices.Data.MimeContent("UTF-8", mime);
await email.Save(_Inbox);


Any help will be appreciated
Reza Matin

0 Replies