Friday, August 07, 2009

SPLibrary – Library to access SharePoint, without being on the SharePoint server (Think SharePoint Web Service Helper)

Mikael Söderström - SPLibrary – A SharePoint Library on a CodePlex near you

“I have just released SPLibrary, a SharePoint Library written in C# on CodePlex. It works with the SharePoint web services and do not have to run on the same server as SharePoint.

Examples

Get all sites

SPLibrary sp = new SPLibrary(new Uri("http://moss"), new NetworkCredential("user", "password", "domain"));
SPWeb[] webs = sp.GetWebs();

Get all lists for a site

SPLibrary sp = new SPLibrary(new Uri("http://moss"), new NetworkCredential("user", "password", "domain"));
SPList[] lists = sp.GetLists();

Get a specific list

SPLibrary sp = new SPLibrary(new Uri("http://moss"), new NetworkCredential("user", "password", "domain"));
SPSingleList list = sp.GetList("List ID (GUID)");

Get all items in a list

SPLibrary sp = new SPLibrary(new Uri("http://moss"), new NetworkCredential("user", "password", "domain"));
SPListItem[] listitems = sp.GetListItems("List ID (GUID)"); //All items
SPListItem[] listitems = sp.GetListItems("List ID (GUID)", Dictionary<string, string>); //

…” [GD: Post Leach Level: 90%]

CodePlexSPLibrary

“…

A SharePoint library that uses the Web Services delivered by SharePoint. You can easily enter a URL to the SharePoint site and list sites, lists and items, search the site etc.

It´s written in C# and is compatible with .NET Framework 2.0 and later.

I started writing this library for test purposes, but it should be stable enough to use in production. If you intend to use it in production, make sure you cache so much as possible, such as sites, lists etc.

There can be some test code left, but that wont affect anything.

…”

If you’re looking for an example of how to access/talk to/get at/etc SharePoint via its Web Services, then this is a project you may want to check out.

It’s for those of you who want to interact with SharePoint externally, say from your own application, site, etc. SharePoint is “the thing” right now, leveraging your internal SharePoint and integrating it into your app’s may be one way of dipping your own foot into the SharePoint waters. I mean why right an admin UI, security, web UI, etc, etc, if all your app needs is a group of lists to hold things? Heck, let MS do the hard work and leverage, baby, leverage!

We have a project (that I hope we can release as Source Available one day, but that’s another story) where we interact with SharePoint, pulling down lists, items from lists, etc. This library might of saved us a good bit of time…sigh…

No comments: