SharePoint Lists Web Service and MetaInfo field

Author by Steve Borgwardt

Recently I was working on a K2 BlackPearl workflow project that required me to add a server event (custom code) to an activity that used the SharePoint 2010 lists.asmx web service to query for list items and return them for use in a K2 process.

The custom metadata fields were required for the K2 process, however these fields were not returned as separate attributes when using the GetListItems method of the lists web service.  They only appeared in the cryptic ows_MetaInfo field, which probably could be parsed out using some regular expressions, however I discovered a much simpler solution thanks to this post.

Simply add a new attribute, Properties='True' to your xml node when passing it to the web service. 

Initially this didn't work, but once you include in your view fields CAML, it will return all your custom fields as separate attributes prefixed with 'ows_metainfo_attributename'. 

So your view field CAML should look like:


    
    

This makes it very easy to access each attribute instead of trying to RegEx the MetaInfo string.

Author

Steve Borgwardt

Senior Application Developer