开发者

Exchange Web Services API 1.0 Error

开发者 https://www.devze.com 2023-01-24 10:33 出处:网络
I\'m getting the following error when trying to connect to my exchange server at Microsoft Online. I couldn\'t see how to get access to the underlying XML and I wondered if this e开发者_StackOverflow中

I'm getting the following error when trying to connect to my exchange server at Microsoft Online. I couldn't see how to get access to the underlying XML and I wondered if this e开发者_StackOverflow中文版rror is caused because exchange is just serving the standard OWA login form, rather than an XML response that the EWS API expects. How can I check this?

This is the error, thrown on the the last line of my code: '>' is an unexpected token. The expected token is '"' or '''. Line 7, position 62.

This is my code:

Dim ews As New ExchangeService
ews.Credentials = New WebCredentials("mytestmailbox@mydomain.com", "mypassword")
ews.Url = New Uri("https://mysubdomain.microsoftonline.com")

'send a test message
Dim message As New EmailMessage(ews)
message.Subject = "Hello World!"
message.Body = "This is a test message"
message.ToRecipients.Add("some@email.com")
message.SendAndSaveCopy()


I fixed this by changing the Uri to the following: https://servername/ews/Exchange.asmx

0

精彩评论

暂无评论...
验证码 换一张
取 消