Using EWS API to search through different users mailboxes

本小妞迷上赌 提交于 2019-12-04 10:08:05

问题


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:

  • Which is the better way to do this? Will it consume a lot of time and resources?

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.


回答1:


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("user_with_access@example.com", "password");
service.AutodiscoverUrl("a_valid_user@example.com");

var userMailbox = new Mailbox("target_user@example.com");
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!




回答2:


A full working example of what @smcintosh has done above is here: Office365 API - Admin accessing another users/room's calendar events. It is a full java class that should compile and run and accesses a room resource calendar. Good luck!



来源:https://stackoverflow.com/questions/1614720/using-ews-api-to-search-through-different-users-mailboxes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!