/ Published in: C#
Use the exchange SOAP api to retrieve sent messages.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using Microsoft.Exchange.WebServices.Data; internal static ExchangeService ExchangeService { get { var exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1); //Or ExchangeVersion.Exchange2010 //Use NetworkCredential in the ExchangeServiceBase namespace (If this line is excluded, current user will be used) //URL to the exchange service exchangeService.AutodiscoverUrl("emailAddress"); //Use email address to find uri //exchangeService.Url = new Uri(exchangeServiceUrl); //set explicit path to uri return exchangeService; } } public static FindItemsResults<Item> GetSentMessages(int pageSize, int offset, out int totalCount) { var findResults = ExchangeService.FindItems(WellKnownFolderName.SentItems, new ItemView(pageSize, offset)); totalCount = findResults.TotalCount; return findResults; }