I need to read list data from SharePoint 2019 on-premise server, from an external server. I have tried calling the REST API but I am having trouble authenticating.

Things I have tried:

  • Calling REST endpoint with Network Credentials:

     var client = new RestClient(url);
     var request = new RestRequest(Method.GET) { Credentials = new NetworkCredential("username", "password", "domain") };
     var response = client.Execute(request);
     return response.Content;

I am getting 403 response in this case.

  • I was successful with a cookie I obtained when accessing the site from the browser (this is not a solution):

     var client = new RestClient(url);
     var request = new RestRequest(Method.GET);
     request.AddHeader("Cookie", "cookie-value");
     return response.Content;

What kind of authentication is needed to perform calls to SharePoint REST API? I have also looked up custom Add-Ins, but can only find documentation for SharePoint Online.

  • Wanted to ask if you were able to authenticate with OAUTH 2 or some other mechanism?
    – Bob
    Sep 29, 2022 at 21:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.