For my code, I retrieve an unread message from exchange, do some processing based on that message, and then reply to the message with the results of the processing I did.
The problem that I'm having is that when I attempt to reply to the email I'm getting the below error on calling responseMessage.send() or responseMessage.sendAndSave():
The current ChangeKey is required for this operation.
Below is the code that I am running that is triggering this error:
public void replyToEmail(EmailMessage _emailMessage, String _reply)
{
String serviceManager = emailServerAddress = ConfigurationSettings.AppSettings["serviceManagerEmail"].Trim();
ResponseMessage responseMessage = _emailMessage.CreateReply(true);
responseMessage.BodyPrefix = _reply;
String changekey = _emailMessage.Id.ChangeKey;
if (!serviceManager.Equals(""))
{
responseMessage.CcRecipients.Add(new EmailAddress(serviceManager));
}
responseMessage.Send();
}
I'm able to check the _emailMessage changeKey value via _emailMessage.id.Changekey and there is a value there, I would have expected that to be assigned to the responseMessage when _emailMessage.createReply() was call. I'm unable to find a way to manually assign it.
I've been unable to find any references to this issue during searching, I was hoping someone
I ran into this problem with .Forward, after setting the message IsRead = true and saving that update back to the server. That changes the ChangeKey, so it's no longer valid.
Try doing _emailMessage.Load() to get the message from the server again, and the new ChangeKey.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With