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. PHP json 对象 数组互相转换

    json格式转为数组/对象 json_decode() json 对象/数组转json格式 json_encode()

  2. U3D Buildin shader

  3. [Xcode 实际操作]六、媒体与动画-(6)使用UIBlurEffect给图片添加模糊效果

    目录:[Swift]Xcode实际操作 本文将演示如何给图像添加模糊效果. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import UIKit class V ...

  4. 2.关键字global,nonlocal

    count=0 def func(): print(count) count+=1 func() UnboundLocalError: local variable 'count' reference ...

  5. 笔记-迎难而上之Java基础进阶3

    统计字符串中每一个不同的字符 import java.util.*; //统计字符串每一个字符出现的字数 public class StringDemo{ public static void mai ...

  6. 在windows IIS服务商配置asp.net core的服务器坏境,并部署

    翻译自https://docs.microsoft.com/en-us/aspnet/core/publishing/iis 另一篇参考的文章 http://www.c-sharpcorner.com ...

  7. cmd 中粘贴复制(转)

    1 如右图,右键命令提示符窗口的标题栏,选择属性. 2 选择“编辑选项”里的“快速编辑模式”,并确定之: 3 在弹出的应用选择提示框上选择“保存属性,供以后具有相同标题的窗口使用”: 4 如此你就可以 ...

  8. Swagger 2.0 集成配置

    传统的API文档编写存在以下几个痛点: 对API文档进行更新的时候,需要通知前端开发人员,导致文档更新交流不及时: API接口返回信息不明确 大公司中肯定会有专门文档服务器对接口文档进行更新. 缺乏在 ...

  9. webpack.config.js====插件purifycss-webpack,提炼css文件

    1. 安装:打包编译时,可以删除一些html中没有使用的选择器,如果html页面中没有class=a class="b"的元素,.a{}.b{}样式不会加载 cnpm instal ...

  10. Mysql中WHERE IN,UNION 用法详解

    WHERE IN 用法 这里分两种情况来介绍 1.in 后面是记录集,如: select  *  from  table  where   uname  in(select  uname  from  ...