Autodiscover service couldn't be located

Hello,

I am writing the script to find the unread email from outlook using powershell script. In addition, download the attachment in the unread email if any attachment is in the email. I got an error while run the script in the below line.

$service.AutodiscoverUrl($mail, $UrlCallback)

Error : Exception calling “AutodiscoverUrl” with "1’ argument(s): “The Autodiscover service couldn’t be located.”

If anyone already face this kind of issue, please reply to this post.

Thanks!

Please always post ALL relevant code and the complete error message - both fomratted as code, please.

You can format text as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance