‘Autodiscover service couldn’t be located’ when trying to access Exchange 2010 account with EWS MANAGED API

You got Service.Credentials wrong, use it like this: Service.Credentials = new WebCredentials(username, password, domainname); Using domain credentials, not the email address. Also doublecheck the following: The version you specify in new ExchangeService() matches server’s the parameter passed to Service.AutodiscoverUrl(); is correct (email address which data needs to be fetched) The following works for me (in … Read more

EWS API – Error when recreating notification subscriptions

Given the documentation at: https://msdn.microsoft.com/en-us/library/office/dn458788(v=exchg.150).aspx When a subscription is lost, or is no longer accessible, it is best to create a new subscription and not include the old watermark in the new subscription. Resubscribing with the old watermark causes a linear scan for events, which is costly. Instead, create a new subscription and compare folder … Read more

How can I detect if this dictionary key exists in C#?

You can use ContainsKey: if (dict.ContainsKey(key)) { … } or TryGetValue: dict.TryGetValue(key, out value); Update: according to a comment the actual class here is not an IDictionary but a PhysicalAddressDictionary, so the methods are Contains and TryGetValue but they work in the same way. Example usage: PhysicalAddressEntry entry; PhysicalAddressKey key = c.PhysicalAddresses[PhysicalAddressKey.Home].Street; if (c.PhysicalAddresses.TryGetValue(key, out … Read more