Exchange Webservice [英] Exchange Webservice

查看:177
本文介绍了Exchange Webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用Exchange Web服务开发一个api来从邮箱中检索电子邮件
我收到以下错误:

请求失败。远程服务器返回错误:(401)未经授权。

这是我的代码:
 
   

Hi
i am developing an api to retrive email's from a mailbox using the Exchange Web service
i am getting the following error:

Request failed. The remote server returned an error: (401) Unauthorized.

this is my code:
 
   

service.Credentials = new WebCredentials(@"username", "pass", "domain");
service.AutodiscoverUrl("username@domain.com");

//obviously i use the correct credentials in my code

//this is where the error occures.
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox,new ItemView(10));
foreach (Item item in findResults.Items)
{
// Do something with the item.
}


谢谢是提前。

thanks is advance.

推荐答案


  • 请验证accountName,密码和域是否正确?

  • 检查Autodiscover发现的EWS URL(ExchangeService上的url属性)。

  • 您知道服务器的EWS URL是什么吗?您是否正在尝试发送请求?如果是这样,请手动将其输入到ExchangeService上的URL中。

  • 还请打开跟踪(ExchangeService.TraceEnabled = true)并验证请求/响应吗?

  • Please verify the accountName, password and domain are all correct?
  • Check the EWS URL that's discovered by Autodiscover (the url property on the ExchangeService).
  • Do you know what the EWS url is for the server you are trying to send the request against? If so, manually type it in, into the URL properpty on ExchangeService.
  • Also please do turn on tracing (ExchangeService.TraceEnabled = true) and verify the requests/responses?


这篇关于Exchange Webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆