For several years I had used WinISP to host my DNS and test IIS server.  This program was recently discontinued and I was forced to migrate my DNS to another provider.  Since I was only using Office365 Exchange Online, the migration was straightforward.  I chose to use Rackspace Cloud DNS (a free service) to host my DNS.  I set my DNS records to a TTL of 5 minutes in preparation for the transfer.  I updated my name servers to point at the Rackspace DNS servers, and within 24 hours my DNS information had propagated, mostly. 

I checked my mailflow to my domain (sqlserver.org), which worked fine.  I then did a quick connectivity test for EWS using http://www.testexchangeconnectivity.com.  This test failed, it wasn't properly finding the Autodiscover endpoint for Exchange online.  I looked at my DNS, and there was a record missing for Autodiscover.  I had to add a CNAME record called Autodiscover, which pointed at autodiscover.outlook.com.  Once this propagated, I was able to find the EWS endpoint.  Here is a snippet of a successful Autodiscover request for Exchange online (full results are much longer):

<Protocol>
<Type>EXCH</Type>
<ASUrl>https://ch1prd0102.outlook.com/EWS/Exchange.asmx</ASUrl>
</Protocol>
</Internal>
<External>
<OWAUrl
AuthenticationMethod="Fba">https://ch1prd0102.outlook.com/owa/sqlserver.org</OWAUrl>
<Protocol>
<Type>EXPR</Type>
<ASUrl>https://ch1prd0102.outlook.com/EWS/Exchange.asmx</ASUrl>
</Protocol>

Notice the ASUrl value, this is the endpoint for Exchange Web Services in Exchange online.  Your value may be slightly different depending on where your Exchange Org is, and your geographic location.  So now I knew the Autodiscover endpoint was working.  I then wrote a simple Console App to test connectivity to the EWS endpoint. 

Here is the sample code I used (note that this is Proxy generated code using wsdl.exe).  Put this in the Main method of your console app:

//Do the service binding piece first 
Console.WriteLine("Binding to Exchange in the cloud...\n\n");
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.RequestServerVersionValue = new RequestServerVersion();
esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2010_SP2;
esb.Credentials = new NetworkCredential("user@domain.com", "password");
esb.Url = @https://ch1prd0102.outlook.com/EWS/Exchange.asmx;

//Create an email using the cloud account
Console.WriteLine("Creating a new email request...\n\n");
CreateItemType createEmailRequest = new CreateItemType();

//Create the request to send and save a copy in sent items
createEmailRequest.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
createEmailRequest.MessageDispositionSpecified = true;
createEmailRequest.SavedItemFolderId = new TargetFolderIdType();
DistinguishedFolderIdType sentitems = new DistinguishedFolderIdType();
sentitems.Id = DistinguishedFolderIdNameType.sentitems;
createEmailRequest.SavedItemFolderId.Item = sentitems;
createEmailRequest.Items = new NonEmptyArrayOfAllItemsType();

Console.WriteLine("Creating email message...\n\n");
MessageType message = new MessageType();
message.Subject = "Test EWS Message";
message.Body = new BodyType();
message.Body.BodyType1 = BodyTypeType.Text;
message.Body.Value = "This is a test message using EWS";
message.Sender = new SingleRecipientType();
message.Sender.Item = new EmailAddressType();
message.Sender.Item.EmailAddress = "user@domain.com";
message.ToRecipients = new EmailAddressType[1];
message.ToRecipients[0] = new EmailAddressType();
message.ToRecipients[0].EmailAddress = "user@domain.com";
message.Sensitivity = SensitivityChoicesType.Normal;

createEmailRequest.Items.Items = new ItemType[1];
createEmailRequest.Items.Items[0] = message;

//Send the message 
Console.WriteLine("Sending a test message...\n\n");
CreateItemResponseType createItemResponse = esb.CreateItem(createEmailRequest);
ArrayOfResponseMessagesType responses = createItemResponse.ResponseMessages;

I was now up and running again with my EWS endpoint. In future postings, I'll show some other challenges I've recently encountered with Web Services. A couple of these challenges include developing EWS applications for WinRT, and the differences between svcutil.exe and wsdl.exe when you use Proxy generation for EWS.

Feel free to post any questions you have if you've run into similar challenges.