0

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?

MattM
  • 11
  • 2
  • How about: 1. Getting the delegates for the mailbox. 2. Looking for the email message's id in those mailboxes. – Alex Filipovici Jul 31 '13 at 13:51
  • Hi Alex, thanks for your response. I can get the list of delegates with access to the mailbox and I can get the ID of the email message but if, for example, eight people have delegated access to this mailbox, I can't see how to identify which of these individuals have sent them email. – MattM Jul 31 '13 at 15:14
  • Do as I suggested: look in their mailboxes. – Alex Filipovici Jul 31 '13 at 15:30
  • Hi Alex - thanks again for your comment - but the email is not saved into their inboxes. The email is saved in the delegated (shared) mailbox - a search of the individual's mailboxes will return nothing for that messageid. Or am I missing something? – MattM Jul 31 '13 at 15:38
  • Read this article: [Mystery of the sent item!](http://blogs.technet.com/b/sachinshah/archive/2012/08/29/mystery-of-the-sent-item.aspx). It should be enlightening :) – Alex Filipovici Jul 31 '13 at 15:47

0 Answers0