Retrieving email using Exchange Web Services problem

Hi,

After connecting to exchange and filter the emails

ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2013_SP1);

foreach (EmailMessage message in unreadMessages)
{
message.Load();
string temp = message.Subject;
}

the strange thing is that my email subject is not the one that is send for example, if i send a email with the subject DEMO|502|Marcio|20150909|10|100 when i do message.Subject it returns DEMO|502|Marcio|20150909|10|001
When i split the message.Subject string by the | and try to convert the last string to int32 it gives a error saying that it cant convert.

When i convert the subject to charArray i get an extra char between the last "1" and "00", unicode 8207, an right to left mark.

Is there any way to remove this and get the correct subject (DEMO|502|Marcio|20150909|10|100). 

Best Regards, Pedro Soeiro.

  • Moved by CoolDadTxMVP Friday, September 11, 2015 4:59 PM Exchange related
September 11th, 2015 11:03am

The left to right mark is there for a purpose eg you have sent that message from a client or Mailbox that has the regional setting set to a language like Hebrew etc that flows right to left (on a normal US English mailbox you won't see this).  Exchange will return what it has stored the (control mark)left to right mark should be the first thing in the string eg I would suggest you look at the one of the offending subjects with a Mapi editor you should see something like

(in your case you want to look at the Subject property). If you don't want the control character in the script then you will need to write your own code to deal with that.

Free Windows Admin Tool Kit Click here and download it now
September 14th, 2015 12:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics