Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

messageToForward.Forward error

$
0
0

I have a Windows Service that cycles through Email and inserts parsed data in a SQL Server.  It works!  I'm trying to forward Emails that need additional attention to an administrator.  Can anyone tell me why I'm getting the below error?  I get it at messageToForward.Forward(messageBodyPrefix, address);.

Thanks

ERROR:

ex = {"The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/types:EmailAddress' element is invalid - The value '' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:NonEmptySt...

EmailMessage msg = EmailMessage.Bind(service, item.Id, PropSet);

COMMAND:

ForwardMessage(msg,"ATTENTION NEEDED","Admin");

CODE:

public void ForwardMessage(EmailMessage messageToForward, string subject, string DL)
{
    string distribution = "";
    switch (DL)
    {
        case "Admin":
            distribution = extractorAdminEmailAddress;
            break;
        case "Support":
            distribution = extractorSupportEmailAddress;
            break;
    }                    
    string messageBodyPrefix = "Automatic Forward by Telecomm Extractor.  [DO NOT REPLY]";
    EmailAddress[] addresses = new EmailAddress[1];
    addresses[0] = new EmailAddress(distribution);
    messageToForward.Subject = "[" + subject + "] " + messageToForward.Subject;

    messageToForward.Forward(messageBodyPrefix, address);
}



Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>