Extract List Column Data From Sharepoint 2010 ows_MetaInfo

All of the list attributes (columns) can be found in the ows_MetaInfo attribute. This is just a huge string packed with information that you can parse to extract. So far I’ve been able to gather the following about this data:

  1. Keys that start with “vti_*****” are predefined list attributes (e.g. vti_title, vti_author, vti_modifiedby, etc)
  2. Keys that start with “_dlc_****” contain data about the resource itself (e.g _dlc_DocIdUrl, _dlc_DocIdItemGuid, etc)
  3. Keys that are the exact name of an attribute are columns that you added to the list after creation. (e.g. My Custom Cost)

To extract any of this data I use the following to regular expressions functions:

// First get the key / value you want. In this instance I want the custom "title" column I added to the list.
preg_match('/(?=vti_title).*/', $result->getAttribute("ows_MetaInfo"), $match); // Returns "vti_title:RW|my title is this: what?"

// Extract the value
$title = preg_replace('/w*:w{2}|/', '', $match[0]); // Returns "my title is this: what?"