We are developing a module with the main goal being to track and collect information about damage inspections (insurance market). Each case has a code (e.g. L000525). Each case could be managed by several people. All the emails related to a specific case include the case code in the subject.
What we want to do is to collect and show the incoming and sent emails related to each specific case.
The idea is that any user can open a "Case management" window, select an specific case, and then get all the related information (including the emails of course).
We have to find the emails into the the mailboxes of around 20 users. So the questions are:
We are new in the Exchange world so we are thinking Exchange impersonation, but we are not sure at all. The module is developed in Silverlight 3, WCF, SQL Server + Exchange 2007.
If the credentials used to connect to EWS have rights to access a user's mailbox then you should be able to do something like this:
var service = new ExchangeService();
service.Credentials = new WebCredentials("[email protected]", "password");
service.AutodiscoverUrl("[email protected]");
var userMailbox = new Mailbox("[email protected]");
var folderId = new FolderId(WellKnownFolderName.Inbox, userMailbox);
var itemView = new ItemView(20); // page size
var userItems = service.FindItems(folderId, itemView);
foreach (var item in userItems)
{
// do something with item (nb: it might not be a message)
}
That's it. Wow, my first SO answer!