Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Connect to outlook.com mailbox via EWS API

$
0
0

Hi guys,

Can you tell me if it is possible to connect to a outlook.com mailbox via the EWS API.

I can connect to my office 365 company account via the API, but not the outlook.com account.

I have enabled POP on the mailbox, but still no luck.

ExchangeService service = new ExchangeService();

            service.Credentials = new NetworkCredential("myEmail@outlook.com", "MyPassword");
            service.UseDefaultCredentials = false;

service.AutodiscoverUrl("myEmail@outlook.com", RedirectionUrlValidationCallback); // Fails here with below exception message

FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(20));
private static bool RedirectionUrlValidationCallback(string redirectionUrl)
        {
            // The default for the validation callback is to reject the URL.
            bool result = false;

            Uri redirectionUri = new Uri(redirectionUrl);

            // Validate the contents of the redirection URL. In this simple validation
            // callback, the redirection URL is considered valid if it is using HTTPS
            // to encrypt the authentication credentials.
            if (redirectionUri.Scheme == "https")
            {
                result = true;
            }

            return result;
        }

Exception Message:

The expected XML node type was XmlDeclaration, but the actual type is Element.

Thanks in advance.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>