Geeks With Blogs

@mhuguet
  • mhuguet Saw a woman using a payphone at the airport. Wow, people still do that although rare! about 411 days ago

News


INETA Community Speakers Program


Mike Huguet
Mike Huguet

A smörgåsbord of technology

View my profile on LinkedIn





Mike Huguet I'm just talking out loud

It has been a long time coming and I was finally able to find a diamond in the rough by locating a wrapper for the “challenging” yet powerful Lists.asmx service provided by WSS 3.0.  On my current project we had the need to interact with WSS to pull back some document templates that reside in a document library.  It only made sense for the implementation of this repository to use Lists.asmx or interact with a custom service that uses the SharePoint object model.  I figured by now someone had created a simplified way to interact with Lists.asmx without having to deal with all of the complexities of the XML.  After using multiple search engines, I found a comment in a Blog that subtly mentioned the solution.  Hidden away at the very end of an article on MSDN, http://msdn.microsoft.com/en-us/library/dd365137.aspx, there is mention of SharePointUtility.dll.  This assembly includes the static wrapper class.  It is part of a great project on CodePlex that focuses on SSIS extensions, http://www.codeplex.com/SQLSrvIntegrationSrv.  A co-worker actually just used this today to move data from one column in a list to another and it worked like a charm.

The assembly can be downloaded as a separate download or you can get the source from the source control tab on http://www.codeplex.com/SQLSrvIntegrationSrv. While we are currently only using this for development, so far so good.   Here is a sample of its usage of getting data from a document library:

[WebPermission(SecurityAction.Assert)]
public List<ServicePaperworkTemplate> FindForServices(List<Service> services)
{
List<ServicePaperworkTemplate> results = null;
List<Dictionary<string, string>> resultFromSharePoint = null;
string queryString = default(string);
XElement query;

//These are the fields that we want in the result set.
string[] resultFields = new string[]
{
Fields.ID,
Fields.DateCreated,
Fields.DateUpdated,
Fields.DocumentEncodedAbsoluteUrl,
Fields.DocumentTitle,
Fields.DocumentVersion,
Fields.UserCreated,
Fields.UserUpdated,
Fields.ServicePaperworkTemplatePageCount,
Fields.ServicePaperworkTemplateServiceAbbreviation
};

queryString = _buildCamlQueryForFilteringByServiceAbbreviation(services);
query = XElement.Parse(queryString);

//Query SharePoint for the list items based on the CAML query string.
resultFromSharePoint = ListServiceUtility.GetListItemData(SharePointSiteUrl, Lists.ServicePaperworkTemplates,
resultFields, query, true, 10) as List<Dictionary<string, string>>;

//Translate from the results to the list of business entities.
results = EntityFactory.Create(resultFromSharePoint, false) as List<ServicePaperworkTemplate>;

//Fill in the documents.
_populateTemplateDocuments(results);

return results;
}

Technorati Tags: ,,
Posted on Thursday, September 10, 2009 11:00 PM | Back to top


Comments on this post: Wrapper for the SharePoint List Service

# re: Wrapper for the SharePoint List Service
Requesting Gravatar...
Very nice example!

Do you have a solution file that I could check?
Left by Microcontroleur on Oct 05, 2009 11:01 AM

Your comment:
 (will show your gravatar)
 


Copyright © Mike Huguet | Powered by: GeeksWithBlogs.net | Join free