TransWikia.com

Calling SharePoint list.amx service throws error - The authentication header received from the server was 'NTLM'

SharePoint Asked by Ojas Maru on November 17, 2021

Here is my scenario : I am trying to access SharePoint 2010 list items via list.asmx service. Following is my code and app.config which works on my developer box hosting the SharePoint site

var client = new ServiceReferenceSPList.ListsSoapClient();
client.ClientCredentials.UserName.UserName = "...";
client.ClientCredentials.UserName.Password = "...";
var result = client.GetListItems("My List", null, query, viewFields, rowLimit, queryOptions, null);

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="ListsSoap" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Ntlm"/>
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://server:port/_vti_bin/Lists.asmx"
        binding="basicHttpBinding" bindingConfiguration="ListsSoap"
        contract="ServiceReferenceSPList.ListsSoap" name="ListsSoap" />
  </client>
</system.serviceModel>

Above code works when its run from SharePoint machine itself. I have SharePoint site on my machine and hence when I run above code it returns list items. However when I try to access SharePoint site hosted on other server on the network it throws error

The HTTP request is unauthorized with client authentication scheme ‘Ntlm’. The authentication header received from the server was ‘NTLM’.

I have read few posts around this error but none seems to help.

I dont think I am facing double hop issue as I am passing credentials and code on development box directly going to SharePoint server. SharePoint 2010 site being accessed in a Claims enabled NTLM auth site.

Please let me know your suggestions to possibly solve this issue.

One Answer

You have to log in to target site manually, with that service account. Seems like the client just can not login to the site at the first time.

Answered by Mel on November 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP