Rest services access to Sharepoint List

I like to display all the lists on our sites. I followed the instructions and getting Response.StatusCode.Forbidden.

Do I have to grant permission on office 365 sharepoint ste admin or my code is missing anything.

Bikram

  System.Net.Http.

HttpClient_Client = newSystem.Net.Http.HttpClient();

            _Client.BaseAddress =

newUri(baseURL);

            _Client.DefaultRequestHeaders.Accept.Add(

newMediaTypeWithQualityHeaderValue(@"application/atom+xml"));

            _Client.DefaultRequestHeaders.Authorization =

newAuthenticationHeaderValue("Basic", _FormatBasicAuth(Domain, User, Password));

        

//   HttpResponseMessage resp = _Client.GetAsync("web/lists/GetByTitle('MyList')").Result;


           

HttpResponseMessageresp = _Client.GetAsync("api/web/lists").Result;

           

stringrespString = resp.Content.ReadAsStringAsync().Result;

           

if(resp.StatusCode == HttpStatusCode.OK)

            {

            

//   ProcessTheRESTAPIResults(respString);


            }

July 23rd, 2015 4:02pm

Hi,

Why don't you use Client Object Model instead of plain HTTP based approach? http://blogs.msdn.com/b/kaevans/archive/2014/02/23/call-o365-using-csom-with-a-console-application.aspx

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 10:31pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics