Wednesday, February 17, 2010

Consuming SharePoint Web Services with WCF

I had a few problems getting the WCF config correct to call SharePoint web services so thought I would share the solution that worked for me:

ClientCredentials - client credentials are required

using (ListsSoapClient proxy = new ListsSoapClient())
proxy.ClientCredentials.Windows.ClientCredential = new NetworkCredential();

Web.config or app.config - NTLM required

<binding name="ListsSoap" maxReceivedMessageSize="9999999">
<readerQuotas maxBytesPerRead="9999999"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
<endpoint address="http://corporate-portal.ccc/_vti_bin/Lists.asmx" binding="basicHttpBinding" bindingConfiguration="ListsSoap" contract="SPLists.ListsSoap" name="ListsSoap"/>

No comments: