Some threading stuff.
This commit is contained in:
@@ -69,7 +69,7 @@ public static class OutlookIntegratorExtensions
|
||||
return mailCopy;
|
||||
}
|
||||
|
||||
public static Message AsOutlookMessage(this MimeMessage mime, bool includeInternetHeaders)
|
||||
public static Message AsOutlookMessage(this MimeMessage mime, bool includeInternetHeaders, string conversationId = null)
|
||||
{
|
||||
var fromAddress = GetRecipients(mime.From).ElementAt(0);
|
||||
var toAddresses = GetRecipients(mime.To).ToList();
|
||||
@@ -93,6 +93,12 @@ public static class OutlookIntegratorExtensions
|
||||
Attachments = []
|
||||
};
|
||||
|
||||
// Set ConversationId if provided to maintain threading
|
||||
if (!string.IsNullOrEmpty(conversationId))
|
||||
{
|
||||
message.ConversationId = conversationId;
|
||||
}
|
||||
|
||||
// Headers are only included when creating the draft.
|
||||
// When sending, they are not included. Graph will throw an error.
|
||||
|
||||
|
||||
@@ -1231,7 +1231,9 @@ public class OutlookSynchronizer : WinoSynchronizer<RequestInformation, Message,
|
||||
// Alias support is lacking with direct MIMEs.
|
||||
// Therefore we convert the MIME message to Outlook message and use proper APIs.
|
||||
|
||||
var outlookMessage = mimeMessage.AsOutlookMessage(false);
|
||||
// Pass the ConversationId (ThreadId) to maintain threading for replies/forwards
|
||||
var conversationId = sendDraftPreparationRequest.MailItem.ThreadId;
|
||||
var outlookMessage = mimeMessage.AsOutlookMessage(false, conversationId);
|
||||
|
||||
// Create attachment requests.
|
||||
// TODO: We need to support large file attachments with sessioned upload at some point.
|
||||
|
||||
Reference in New Issue
Block a user