Hi how can I call this API


from Console Application

I used below Code

string ListExportURL = http://YOUR_SERVER_URL/PATH_TO_SITE_CONTAINING_LIST/_vti_bin/owssvr.dll?Cmd=ExportList&List={YOUR_LIST_GUID};
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(ListExportURL);
System.Net.NetworkCredential credentialCache = new System.Net.NetworkCredential(username, password);
webRequest.Credentials = credentialCache;
webRequest.Method = "GET";
webRequest.ContentType = "text/xml";
HttpWebResponse res = webRequest.GetResponse() as HttpWebResponse;
Stream strem = res.GetResponseStream();
StreamReader reader = new StreamReader(strem);
string xmlResult= reader.ReadToEnd();

I am getting an error 403 forbidden. anyone please help

1 Answer 1


You code is perfectly fine. just check below things,

  1. If you put directly above url in browser, does it return xml data in browser, it should first work in browser

2/ Other thing which i suspect is that If above API is blocked from IIS, sometimes sharepoint admins blocks this due to security reason.

  1. Also while passing credentials, make sure you are passing domain also, I have seen that it give unauthorized error is credentials is not password as below.

    System.Net.NetworkCredential credentialCache = new System.Net.NetworkCredential("onlyuserid", "password","domainname");
  • yes when I am hitting that url in browser that will download the xml file in response.
    – Negi Rox
    Feb 26, 2018 at 12:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.