Skip to main content


Showing posts from September, 2006

Mixing SharePoint and Java

The primary development environment where I work is Java on Unix. However, we've started to move to SharePoint for collaborative development. If you've ever worked with SharePoint from the client side, typically you'll see something like this in your C# code:

someSharePointServiceWebReference.PreAuthenticate = true;
someSharePointServiceWebReference.Credentials = CredentialCache.DefaultCredentials;

Those two lines encompass a lot of activity behind the scenes. Essentially you're asking the .NET framework to authenticate you with an NTLM hash.

All is not lost if you want to do the same thing in Java. Version 3.0 of the Jakarta HttpClient can manage NTLMv1 authentication. Create an instance of org.apache.commons.httpclient.NTCredentials and you're set.

Storing files in a document library is pretty easy. Just use the HTTP "PUT" verb. About the only tricky part is determining the URL to pass to the PutMethod constructor. The URL has to be the URL of the do…