Following is my code.

 ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);

   service.TraceEnabled = true;

   service.Credentials = new WebCredentials("xx@xx.com", "xxxx123");

   service.Url = new Uri("https://mail.xxxxxx.com/EWS/Exchange.asmx");

   FolderView v = new FolderView(5);

   ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCallback;

   service.FindFolders(WellKnownFolderName.Inbox, v);

   //Error on above line.

I tried changing the code line as below and I get another Error ....

service.Credentials = new NetworkCredential("xx@xx.com", "xx","xxxxxxxx");

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

How do i resolve.   and what is difference between NetworkCredential and WebCredentials ?

This is Resolved.

I figure out that the problem was in code line

service.Credentials = new NetworkCredential("xx@xx.com", "xx","xxxxxxxx");

Instead of xx@xx.com  it should be just username 'xx'.     That Solved.

Phew!!

Regards

EWS code return Error : Request failed. The remote server returned an error: (403) Forbidden OR (401) Unauthorized的更多相关文章

  1. unity 打包Error:WebException: The remote server returned an error: (403) Forbidden.

    記一下在ios上打包出錯: UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlaye ...

  2. Call Azure Queue get "The remote server returned an error: (400) Bad Request."

    这几天开始研究Windows Azure, 在使用Azure Queue 的时候,CreateInfNotExists 总是抛出异常 "The remote server returned ...

  3. WebService:The remote server returned an error: (400) Bad Request

    开发工具:VS2010.开发组件:WebService.运行环境:Windows 今天一个同事在进行计费接口联调试时,发现了一个非常奇怪的问题:接口在家里环境测试,一切正常,但是部署到现网环境之后,连 ...

  4. System.Net.WebException : The remote server returned an error: (415) UNSUPPORTED MEDIA TYPE

    I am having problems with a bit of code that accesses a restful web service. Running this code, it e ...

  5. request 报错The remote server returned an error: (415) Unsupported Media Type.

    开发时遇到个问题,程序访问数据库数据,给服务器发送请求时,老是报错,返回的错误页面是: HTTP Status 415 - Unsupported Media Type type Status rep ...

  6. HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.

    1. Supply the credentials of the Currently Logged on User to the Proxy object similar to this: // Be ...

  7. WP8 调用webservice 错误 The remote server returned an error: NotFound 解决

    本人出错是由于本地的IIS不能被局域网其它机器访问导致的,如果你所用的本机IIS 也不可被其它机器访问,则可按照本文进行设置   具体操作时需要在防火墙设置中添加 入站规则   具体步骤如下: 1.控 ...

  8. axios请求报Uncaught (in promise) Error: Request failed with status code 404

    使用axios处理请求时,出现的问题解决 当url是远程接口链接时,会报404的错误: Uncaught (in promise) Error: Request failed with status ...

  9. CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

    今天,在用icinga服务器端测试客户端脚本时,报如下错误: [root@mysql-server1 etc]# /usr/local/icinga/libexec/check_nrpe -H 192 ...

随机推荐

  1. 浅谈css常用伪类用法

    着重写一下after和before的用法: css样式搞定:标签元素+伪类after a.'class名':after{//我的样式名称是这个,可以写成你自己的样式名称 content: '已打包'; ...

  2. 关于setTimeout(fn,0)

    JS是单线程引擎:它把任务放到队列中,不会同步去执行,必须在完成一个任务后才开始另外一个任务. 浏览器的内核是多线程的,它们在内核制控下相互配合以保持同步,一个浏览器至少实现三个常驻线程:javasc ...

  3. JQuery Easyui/TopJUI 用JS创建数据表格并实现增删改查功能

    JQuery Easyui/TopJUI 用JS创建数据表格并实现增删改查功能 html <table id="productDg"></table> &l ...

  4. C 语言实例 - 判断数字为几位数

    C 语言实例 - 判断数字为几位数 用户输入数字,判断该数字是几位数. 实例 #include <stdio.h> int main() { long long n; ; printf(& ...

  5. php对数组操作的函数

    array_reverse  以相反的顺序返回数组 array_unique 数组元素去重(只对一维数组有效) array_intersect两个或多个数组取交集   implode和explode也 ...

  6. linux 02 基础命令

    linux 02 基础命令 1.alias 别名 pyvip@Vip:~/demo$ alias lh="ls -lh" #将ls -lh的功能赋给lh(lh原来并没有意义)这个赋 ...

  7. Codeforces Round #527-B. Teams Forming(贪心)

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  8. 如果查询的结果少,可以把查询结果当子集,再查另一张表,比join的速度快得多得多

    ) as qty from riv_print_history_l phl JOIN tab_user_profile up on up.UP_USER_ID = phl.PHL_PRINT_USER ...

  9. 一篇文章彻底了解Java垃圾收集(GC)机制

    垃圾收集(Garbage Collection ,GC),是一个长久以来就被思考的问题,当考虑GC的时候,我们必须思考3件事情: 哪些内存需要回收? 什么时候回收? 如何回收? 那么在Java中,我们 ...

  10. BI的意义

    BI系统建设的价值,有可能不值钱,也有可能价值数千万,就看我们大家好用了没.”所以,BI系统建设的收获,终究还是因企业而异的,再归根,便是与企业的文化,与企业的人,尤其是管理层是极为相关的了. 商业智 ...