none
EWS Managed API - Set EmailMessage.From on new message RRS feed

  • Question

  • Hi,

    When creating an email on behalf of a user in the AD, who has multiple email addresses, it seems the "set-as-reply" address is used as the from address.

    Is it possible to choose between the users valid (according to AD) addresses?
    Also is it possible to set the friendly display name?
    Should EmailMessage.Sender be used instead of EmailMessage.From? (In my test it has not made any difference.)

    Following does not seem to be working as hoped:
    AD user: Brian Rasmussen-Rene. Email addresses: brian@domain.com (Set-as-reply). developer@domain.com.

    ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
    exchangeService.Credentials = new System.Net.NetworkCredential("username", "password", "domain");
    exchangeService.AutodiscoverUrl("brian@domain.com");
          
    EmailMessage message = new EmailMessage(exchangeService);
    message.From = new EmailAddress();
    message.From.Name = "Developer";
    message.From.Address = "developer@domain.com";
    message.ToRecipients.Add("someone@somewhere.com");
    message.Subject = "TEST";
    message.Body = "TEST";
    message.Body.BodyType = BodyType.Text;
    
    message.Send();
    
    /*
    Will display as from Brian Rasmussen-Rene [brian@domain.com]
    Desired outcome is Developer [developer@domain.com]
    */
    

    Kind regards,
    Brian Rasmussen-Rene

    Friday, January 7, 2011 11:46 AM

All replies