February 18, 2011

Connecting with Python to Sharepoint servers over SOAP

As part of a customer project we had the task to sync data between a Zope 2 application with a Sharepoint server.

Data in Sharepoint is organized as list structures. A list can be considered as a folderish object where the list defines a schema of fields and all items inside the list provide the fields as content (comparable to a Plone folder containing only content of one particular type but the definition of the schema is local to the list/folder).

Sharepoint provides access to its data through SOAP. After some heavy fighting with NTLM authentication and the suds SOAP module for Python I came up with a first version of our Sharepoint connector haufe.sharepoint. haufe.sharepoints right now implements a minimal set of methods in order to manipulate lists in Sharepoint over SOAP:

  • retrieve Sharepoint list definitions
  • retrieve all list items
  • add list items
  • delete list items
  • update list items

My obligatory rant

The Sharepoint SOAP API is such a piece of crap - at least for three reasons:

  • non-speaking error messages like "Value out of range" - totally useless because Sharepoint was a blackbox in our project with no access to logs etc. (except through some external Sharepoint consultants)
  • a crappy SOAP API - in many cases the API requires to pass in additional parameters as XML - totally insane.
  • some API methods just don't work as expected - queries defined through the CAML query language are just ignored without further error messages