Exchange Web Servisleri ile ilgili çalışmaları yapabileceğiniz sanal makineyi bu adresten indirebilirisiniz.
Microsoft Exchange Server 2007 SP1 VHD
hayatında ne yapmak istiyorsan ona göre hareket et!

aşağıdaki kod ile litwareinc.com da hesabı buluna Adil'in
Inbox'ndaki emaillerin başlıklarını listeliyoruz.
private void GetEmails()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate,
X509Chain chain, SslPolicyErrors errors)
{
return true;
};
System.Net.WebProxy proxyObject = new System.Net.WebProxy();
proxyObject.Credentials = CredentialCache.DefaultCredentials;
service.Url = new Uri("https://domain/ews/exchange.asmx");
service.UseDefaultCredentials = true;
Mailbox mb = new Mailbox("Adil@litwareinc.com");
FolderId fid1 = new FolderId(WellKnownFolderName.Inbox, mb);
FindItemsResults<Item> findResults = service.FindItems(fid1,
new ItemView(int.MaxValue));
foreach (var item in findResults)
Response.Write(item.Subject + "<br />");
}
using System.DirectoryServices;ekledikten sonra toplandı odasının adını ve eposta adresini tutacağım class yazıyoruz.
public class RoomMailbox
{
public string Email { get; set; }
public string DisplayName { get; set; }
}
private List<RoomMailbox> GetRooms()
{
List<RoomMailbox> listRoomMailbox = new List<RoomMailbox>();
string sqSearchQuery = "(&(&(&(mailNickname=*)(objectcategory=person)(objectclass=user)(msExchRecipientDisplayType=7))))";
SearchResultCollection srSearchResults;
string roRootDSE = "ldap bağlantı adresi";
DirectoryEntry deDirectoryEntry = new DirectoryEntry(roRootDSE);
DirectorySearcher dsDirectorySearcher = new DirectorySearcher(deDirectoryEntry);
dsDirectorySearcher.SearchScope = SearchScope.Subtree;
dsDirectorySearcher.Filter = sqSearchQuery;
dsDirectorySearcher.PropertiesToLoad.Add("mail");
dsDirectorySearcher.PropertiesToLoad.Add("displayName");
srSearchResults = dsDirectorySearcher.FindAll();
foreach (SearchResult srSearchResult in srSearchResults)
{
listRoomMailbox.Add(new RoomMailbox
{
DisplayName = srSearchResult.Properties["displayName"][0].ToString(),
Email = srSearchResult.Properties["mail"][0].ToString()
}
);
}
return listRoomMailbox;
}
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
private void GetCalendarByMailBox()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate,
X509Chain chain, SslPolicyErrors errors)
{
return true;
};
System.Net.WebProxy proxyObject = new System.Net.WebProxy();
proxyObject.Credentials = CredentialCache.DefaultCredentials;
service.UseDefaultCredentials = true;
service.Url = new Uri("https://domain/ews/exchange.asmx");
Mailbox mb = new Mailbox("Akdeniz@litwareinc.com");
FolderId fid1 = new FolderId(WellKnownFolderName.Calendar, mb);
FindItemsResults<Appointment> findResults = service.FindAppointments(fid1,
new CalendarView(DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5)));
foreach (Appointment appointment in findResults)
{
if ((appointment.AppointmentState & 4) != 4)
Response.Write(appointment.Subject + "<br />");
}
}
if ((appointment.AppointmentState & 4) != 4)
using Microsoft.Exchange.WebServices.Data;ekledikten sonra aşağıdaki örnek kod ile Exchange 2007 üzerinde bulunan toplantı odalarının ilgili kişi ile ilişkili dolu olan saatlerini gösterebiliriz.private void GetCalendarByUser()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate,
X509Chain chain, SslPolicyErrors errors)
{
return true;
};
System.Net.WebProxy proxyObject = new System.Net.WebProxy();
proxyObject.Credentials = CredentialCache.DefaultCredentials;
service.Credentials = new WebCredentials("username", "password", "domain");
service.Url = new Uri("https://domain/ews/exchange.asmx");
CalendarFolder myCalendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar);
FindItemsResultsmyAppointments = myCalendar.FindAppointments(new CalendarView(DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5)));
foreach (Appointment appointment in myAppointments)
Response.Write(appointment.Subject + ", ");
}