SharePoint Web Services, NetworkCredentials, Sore Eyes!

I’ve decided to build a Windows Service that polls a SharePoint document library (based on a filtered view) looking for new InfoPath documents. Once a new document is located, it is checked out, processed, then updated back on the site.

Now, my first challenge is the SharePoint site lives on a server that doesn’t understand my default credentials, which means I can’t use the client api (Microsoft.SharePoint) to do my bidding, and instead, must subject my eyes and patience to the web service api!

After much cut and paste, much deserialization and serialization, and much tea, I’ve finally worked out how to strong arm SharePoint, in short:

  • Generate proxy classes for the web services your need using wsdl.exe (all the SharePoint web services live in http://host/site/_vti_bin/*.asmx)
  • Ensure you set the credentials property of the web services before calling (if you’re default creds don’t cut the mustard on the SharePoint server)
  • Deserialize the xml returned from the web services calls into digestible objects, then party like its 1997!

For those who want to see all this in action, I will be rolling through all this code in my Enterprise InfoPath session at Tech.Ed next week, and will be doing a follow up session in Melbourne at a lunchtime session in the city when I get back. After that, I will post the InfoPath project, the web services projects, and the windows service project to Crunk Code.

Nighty nights 🙂

Skip to main content