[英]Get Sharepoint 2013 List using REST API
I want to get List from Sharepoint using mobile devices therefore I am using REST API with DefaultCredentials,I have already given Read rights to my List but I am getting The remote server returned an error: (401) Unauthorized 我想使用移动设备从Sharepoint获取列表,因此我正在使用带有DefaultCredentials的REST API,我已经授予了对列表的读取权限,但是我正在获取远程服务器返回错误:(401)未经授权
My Code Is: 我的代码是:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("ListUrl");
request.Method = "GET";
request.Accept = "application/json;odata=verbose";
request.ContentType = "application/json;odata=verbose";
request.UseDefaultCredentials = true;
request.PreAuthenticate = true;
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
Is this possible via REST API or is there any other solution? 是否可以通过REST API进行操作,还是有其他解决方案? Is there anything that I am missing?
有什么我想念的吗?
By default, the REST API is restricted to authenticated users, so you must configure it to anonymous users. 默认情况下,REST API仅限于经过身份验证的用户,因此您必须将其配置为匿名用户。 You should upload a query properties template on your site collection's root as described on Mastykarz's post:
您应该按照Mastykarz帖子中的描述,在网站集的根目录上上传查询属性模板:
http://blog.mastykarz.nl/configuring-sharepoint-2013-search-rest-api-anonymous-users/ http://blog.mastykarz.nl/configuring-sharepoint-2013-search-rest-api-anonymous-users/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.