<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pearl Tech &#187; Exchange Server</title>
	<atom:link href="http://blog.pearltechnology.com/tag/exchange-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pearltechnology.com</link>
	<description></description>
	<lastBuildDate>Tue, 25 May 2010 14:37:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Exchange Web Services (EWS) Managed API</title>
		<link>http://blog.pearltechnology.com/exchange-web-services-ews-managed-api/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/exchange-web-services-ews-managed-api/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 13:21:26 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[EWS]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[Exchange Web Services]]></category>
		<category><![CDATA[Managed API]]></category>
		<category><![CDATA[Microsoft Exchange]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=294</guid>
		<description><![CDATA[Unless you are a seasoned COM junky, the Exchange Web Services (EWS) Managed API will come as a welcome addition to anyone needing to programmatically manage Microsoft Exchange appointments, calendars, messages, or any other folders residing on an exchange server. The key difference with EWS is that it is using purely managed code. EWS itself [...]]]></description>
			<content:encoded><![CDATA[<p>Unless you are a seasoned <a href="http://www.microsoft.com/com/default.mspx">COM junky</a>, the Exchange Web Services (EWS) Managed API will come as a welcome addition to anyone needing to programmatically manage <a href="http://www.microsoft.com/exchange/2007/default.mspx">Microsoft Exchange</a> appointments, calendars, messages, or any other folders residing on an exchange server. The key difference with EWS is that it is using <a href="http://msdn.microsoft.com/en-us/library/dd637749.aspx">purely managed code</a>. EWS itself is simply a wrapper around the EWS protocol, so there&#8217;s no need to learn another XML-based interface.</p>
<p>You can <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e8f38dd1-f123-4a16-b4c8-584d1f84af48&amp;displaylang=en">download EWS</a> from Microsoft (<em>currently an RC</em>) and begin interacting immediately with any server running Exchange 2010 or Exchange 2007 running SP1 or higher. The web service interaction requires SSL and a valid <a href="http://msdn.microsoft.com/en-us/library/system.net.networkcredential.aspx">Network Credential</a> for access. The base service is hosted on exchange via the EWS URL below, where &lt;exchange_server_name&gt; is the host name of your Exchange server.</p>
<pre name="code" language="xml">https://&lt;exchange_server_name&gt;/ews/exchange.asmx</pre>
<p>To try out EWS in a test environment, you can <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=E99F2A96-FFBC-4323-9676-9657607C4A52&amp;displaylang=en">download</a> the Exchange 2007 virtual machine. Once the Exchange VM (VHD) is running and you are logged in, you need to configure the network settings to utilize automatic IP and DNS settings instead of the default static ones provided. This will assist in routing network traffic to the new machine. To verify the setup, you can browse the following URL below and see the WSDL for the EWS. You will need to ignore the certificate warning and enter a login with access to the service (<em>login as litwareinc\Administrator</em>)</p>
<pre name="code" language="xml">https://ex07sp1/ews/exchange.asmx</pre>
<p>The next step is <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e8f38dd1-f123-4a16-b4c8-584d1f84af48&amp;displaylang=en">installing EWS</a>. After installation, you can begin creating Visual Studio projects using the new API. <a href="http://msdn.microsoft.com/en-us/library/dd633710.aspx">MSDN</a> provides a nice introduction and valuable references for working with the managed API. After creating a new Visual Studio project, you need to add a reference to the new assembly <em>Microsoft.Exchange.Webservices.dll</em> (located at the path <em>Program Files\Microsoft\Exchange\Web Services\1.0\ </em>). Next, we add using statements for the new library reference and also for <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate.aspx">X509 certificates</a>.</p>
<pre name="code" language="csharp">using Microsoft.Exchange.WebServices.Data;
using System.Security.Cryptography.X509Certificates;</pre>
<p>Now here&#8217;s some simple code to create a connection to the EWS endpoint. The certificate callback is necessary since we&#8217;re using a user-generated X509 certificate.</p>
<pre name="code" language="csharp">// Hook up the cert callback.
            ServicePointManager.ServerCertificateValidationCallback =
                delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
                {
                    // Validate the certificate and return true or false as appropriate.
                    // Note that it not a good practice to always return true because not
                    // all certificates should be trusted.
                    return true;
                };

            // assign exchange version
            ExchangeVersion version = ExchangeVersion.Exchange2007_SP1;

            // create service endpoint connection
            ExchangeService service = new ExchangeService(version);

            // Assign NetworkCredential directly
            service.Credentials = new NetworkCredential("username", "password", "domain");

            // EWS network location
            service.Url = new Uri("https://ex07sp1/ews/exchange.asmx");</pre>
<p>Now we&#8217;ll create an <a href="http://msdn.microsoft.com/en-us/library/dd633661.aspx">appointment</a> using this service endpoint. <em>Note: When you <a href="http://msdn.microsoft.com/en-us/library/dd633620.aspx">add attendees</a>, you actual create a meeting instead of an appointment.</em></p>
<pre name="code" language="csharp">            Appointment appt = new Appointment(service);
            appt.Subject = "Read EWS Documentation";
            appt.Body = "You can download the Exchange 2007 SP2 here: &lt;a href='http://www.microsoft.com/downloads/thankyou.aspx?familyId=ee7829a3-0ae8-44de-822c-908cd1034523&amp;displayLang=en'&gt;SP2 Download&lt;/a&gt;";
            appt.StartTimeZone = TimeZoneInfo.Local;
            appt.Start = DateTime.Now.AddDays(1);
            appt.ReminderMinutesBeforeStart = 15;
            appt.End = appt.Start.AddHours(2);
            appt.RequiredAttendees.Add("Administrator@litwareinc.com");
            appt.Save(); // persisted to exchange</pre>
<p>To probe deeper, you can follow the <a href="http://blogs.msdn.com/exchangedev/">exchange developer blog</a> on MSDN. We look forward to the RTM of this powerful managed Exchange API.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/exchange-web-services-ews-managed-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
