Cannot Get EmailMessage Name to Display in Sent Emails Using EWS

%3CLINGO-SUB%20id%3D%22lingo-sub-2013067%22%20slang%3D%22en-US%22%3ECannot%20Get%20EmailMessage%20Name%20to%20Display%20in%20Sent%20Emails%20Using%20EWS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2013067%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20cannot%20set%20EmailMessage.Name%20to%20display%20a%20custom%20name%20in%20emails%20sent%20via%20Microsoft.Exchange.WebServices.Data%202.2%20(assembly%20v15).%20Is%20it%20being%20overridden%20by%20Exchange%2C%20using%20the%20email%20account's%20Name%3F%20I've%20tried%20all%20possible%20ways%2C%20even%20the%20%22display%20name%3CEMAIL-ADDRESS%3E%22%20format%2C%20nothing%20seems%20to%20work.%20Thanks.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FEMAIL-ADDRESS%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3E%2F%2F%20Example%0Avar%20senderEmailAddress%20%3D%20new%20EmailAddress(%22myemail%40blah.com%22)%20%7B%20Name%20%3D%20%22My%20Name%22%20%7D%3B%0A%2F%2F%20Or%0AsenderEmailAddress%20%3D%20new%20EmailAddress(%22My%20Name%20%3CMYEMAIL%3E%22)%0A%2F%2F%20Or...%20etc.%20tried%20many%20diff.%20ways%2C%20nothing%20works.%20%3A(%0A%0Avar%20message%20%3D%20new%20EmailMessage(exchangeService)%0A%7B%0A%20%20%20%20Sender%20%3D%20senderEmailAddress%2C%0A%20%20%20%20Body%20%3D%20new%20MessageBody(BodyType.HTML%2C%20%22test%22)%2C%0A%20%20%20%20Subject%20%3D%20%22test%22%0A%7D%3B%0A%0Amessage.SendAndSaveCopy(WellKnownFolderName.SentItems)%3B%3C%2FMYEMAIL%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2013067%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EEWS%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange.Office365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Regular Visitor

Hi, I cannot set EmailMessage.Name to display a custom name in emails sent via Microsoft.Exchange.WebServices.Data 2.2 (assembly v15). Is it being overridden by Exchange, using the email account's Name? I've tried all possible ways, even the "display name<email-address>" format, nothing seems to work. Thanks.

 

// Example
var senderEmailAddress = new EmailAddress("myemail@blah.com") { Name = "My Name" };
// Or
senderEmailAddress = new EmailAddress("My Name <myemail@blah.com>")
// Or... etc. tried many diff. ways, nothing works. :(

var message = new EmailMessage(exchangeService)
{
    Sender = senderEmailAddress,
    Body = new MessageBody(BodyType.HTML, "test"),
    Subject = "test"
};

message.SendAndSaveCopy(WellKnownFolderName.SentItems);

 

0 Replies