I am trying to find a way to get the name of the sender of an item in a delegated mailbox in Exchange 2010 via Exchange web services. The scenario is that many delegates have access to a shared inbox and send emails from that inbox as the owner (i.e. 'messagingtest@onetwothree.com') but I would like to be able to identify who sent a particular email.
I can get hold of the sent folder items just fine but can't find a way of identifying the sender.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.Credentials = new System.Net.NetworkCredential("AdministratorUsername", "AdministratorPassword", "onetwothree");
service.Url = new Uri("https://excas.onetwothree.local/EWS/Exchange.asmx");
service.AutodiscoverUrl("exadmin@onetwothree.com", RedirectionUrlValidationCallback);
Mailbox principal = new Mailbox("messagingtest@onetwothree.com");
Folder Ftest = Folder.Bind(service, new FolderId(WellKnownFolderName.SentItems, principal));
FindItemsResults<Item> findAltResults = service.FindItems(new FolderId(WellKnownFolderName.SentItems, principle), new ItemView(10));
foreach (Item SentItem in findAltResults.Items)
{
EmailMessage mss = (EmailMessage)SentItem;
string Sender = mss.Sender.Name; // This just returns the mailbox principal, messagingtest@onewtothree.com, not j.johnson@onetwothree.com
}
Any ideas?