I am using below code to get exchange service however I am getting 'The Autodiscover service couldn't be located' error on the last line.
Dim service As New ExchangeService service.Credentials = New NetworkCredential(userEmailAddress, userPassword) service.AutodiscoverUrl(userEmailAddress, Function(a) True)
What am I doing wrong? The email and password are valid and can login to o365 site fine and access Outlook etc.
I have searched for the solution but the ones I found were for on-premises Exchange.