none
Rest services access to Sharepoint List RRS feed

  • Question

  • 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);


                }

    Thursday, July 23, 2015 7:56 PM

Answers