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?"

One thought on “Extract List Column Data From Sharepoint 2010 ows_MetaInfo”

  1. Here is a JavaScript function to extract list column data

    /**
    * Parses ows_MetaInfo field that stores field values for document library items.
    * ows_MetaInfo field example:
    * "68;#vti_author:SR|..snip..
    vti_description:SW|..snip..
    vti_modifiedby:SR|..snip..
    ContentTypeId:SW|0x01010200....
    vti_title:SW|..snip..
    ContentType:SW|..snip..
    ..snip..
    "

    Pass MetaInfo to function and key for which you want to retreive value.
    Returns null if no such key exists.
    * @param {string} metainfo - ows_MetaInfo field value
    * @param {string} key - field value to extract from metainfo. Alphanumeric characters and underscore only allowed as a key.
    * @throws "Key contains invalid characters" - key with other than alphanumeric or undescore chars passed.
    */
    getMetaInfo = function(metainfo, key) {
    //Key onlt allowed to contain only alphanumeric characters and underscore.
    if(/^w+$/.test(key) === false) {
    throw "Key contains invalid characters. Alhanumeric with underscores only allowed.";
    }

    //Trim item id value: ID;#
    metainfo = metainfo.replace(/^d+;#/g,"");
    //Regex to find matching line (each line corresponds to some field value)
    regexLine = new RegExp("^" + key + ":.*", "m");
    var line = regexLine.exec(metainfo);
    if (line && line.length > 0) {
    //Extract value
    return line[0].replace(/w*:w{2}|(.*)/, "$1");
    }

    return null;
    };

Leave a Reply

Your email address will not be published. Required fields are marked *