1

I am trying to fetch the list of file names which are there in my document library of office 365 SharePoint site.

I am using below code to access the List.asmx Service using Visual Studio 2010.

ServiceReference1.ListsSoapClient ws = new ServiceReference1.ListsSoapClient();
ws.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("USERNAME", "PASSWORD", "sharepoint");            
ws.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
ws.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://XYZ.sharepoint.com/_vti_bin/lists.asmx");
XElement li = ws.GetListCollection();

This code gives me below error while executing ws.GetListCollection() function:

The HTTP request was forbidden with client authentication scheme 'Ntlm'. 

Can anyone help me that? Is there any problem on SharePoint site access permissions or am I missing something in code part or some configuration things?

Jakob Christensen
  • 14,826
  • 2
  • 51
  • 81

0 Answers0