EWS code return Error : Request failed. The remote server returned an error: (403) Forbidden OR (401) Unauthorized
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的更多相关文章
- unity 打包Error:WebException: The remote server returned an error: (403) Forbidden.
記一下在ios上打包出錯: UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlaye ...
- Call Azure Queue get "The remote server returned an error: (400) Bad Request."
这几天开始研究Windows Azure, 在使用Azure Queue 的时候,CreateInfNotExists 总是抛出异常 "The remote server returned ...
- WebService:The remote server returned an error: (400) Bad Request
开发工具:VS2010.开发组件:WebService.运行环境:Windows 今天一个同事在进行计费接口联调试时,发现了一个非常奇怪的问题:接口在家里环境测试,一切正常,但是部署到现网环境之后,连 ...
- 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 ...
- request 报错The remote server returned an error: (415) Unsupported Media Type.
开发时遇到个问题,程序访问数据库数据,给服务器发送请求时,老是报错,返回的错误页面是: HTTP Status 415 - Unsupported Media Type type Status rep ...
- 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 ...
- WP8 调用webservice 错误 The remote server returned an error: NotFound 解决
本人出错是由于本地的IIS不能被局域网其它机器访问导致的,如果你所用的本机IIS 也不可被其它机器访问,则可按照本文进行设置 具体操作时需要在防火墙设置中添加 入站规则 具体步骤如下: 1.控 ...
- axios请求报Uncaught (in promise) Error: Request failed with status code 404
使用axios处理请求时,出现的问题解决 当url是远程接口链接时,会报404的错误: Uncaught (in promise) Error: Request failed with status ...
- 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 ...
随机推荐
- hdu1520 Anniversary party
Anniversary party HDU - 1520 题意:你要举行一个晚会,所有人的关系可以构成一棵树,要求上下级关系的人不能同时出现,每一个人都有一个rating值,要求使整个晚会的ratin ...
- lca最近公共祖先(st表/倍增)
大体思路 1.求出每个元素在树中的深度 2.用st表预处理的方法处理出f[i][j],f[i][j]表示元素i上方第2^j行对应的祖先是谁 3.将较深的点向上挪,直到两结点的深度相同 4.深度相同后, ...
- 加权并查集(银河英雄传说,Cube Stacking)
洛谷P1196 银河英雄传说 题目描述 公元五八○一年,地球居民迁移至金牛座α第二行星,在那里发表银河联邦创立宣言,同年改元为宇宙历元年,并开始向银河系深处拓展.宇宙历七九九年,银河系的两大军事集团在 ...
- uoj#213. 【UNR #1】争夺圣杯(单调栈)
传送门 我们枚举每一个元素,用单调栈做两遍计算出它左边第一个大于它的位置\(l[i]\)和右边第一个大于它的位置\(r[i]\),那么一个区间以它为最大值就意味着这个区间的左端点在\([l[i]+1, ...
- Java基础--面向对象以及相关知识
一. 面向对象特征与原则 1.三大特征:封装.继承.多态. (1)封装:将客观的事物封装成抽象的类,封装代码逻辑,并通过访问控制符来控制访问的方式,从而保护程序(使用反射时,可以获取对象的私有方法和成 ...
- 自动化测试 Cucumber
Cucumber是一个能够理解用普通语言描述的测试用例的支持行为驱动开发(BDD)的自动化测试工具,用Ruby编写,支持Java和.Net等多种开发语言. Cucumber 三大组成: Feature ...
- elasticsearc 参考资料
_source 和store http://stackoverflow.com/questions/18833899/in-elasticsearch-what-happens-if-i-set-st ...
- PAT甲级——1103 Integer Factorization (DFS)
本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90574720 1103 Integer Factorizatio ...
- Codeforces Round #563 (Div. 2) C. Ehab and a Special Coloring Problem
链接:https://codeforces.com/contest/1174/problem/C 题意: You're given an integer nn. For every integer i ...
- POJ-3352-RoadConstruction(边双联通分量,缩点)
链接:https://vjudge.net/problem/POJ-3352#author=0 题意: 给一个无向连通图,至少添加几条边使得去掉图中任意一条边不改变图的连通性(即使得它变为边双连通图) ...