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
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? Is there anything that I am missing?
request.Credentials = new NetworkCredentials("user", "pass", "domain")
or something like that – Max