2

Is there a possibility to access the ListItem.Properties from the Javascript COM? All I'm seeing is the possibility to read all Fields. There also is the funny [SP.ListItem.LoadExpandoFields()][1], but I don't know what it does.

  • I believe you can access this by soap so you would be looking at accessing the soap api via JQuery, failing that make your own handler and call that. – Hugh Wood Aug 21 '12 at 18:52
  • With soap you mean the SP webservices? – Dennis G Aug 21 '12 at 19:27
3

You could try:

item.get_fieldValues().MetaInfo

Full example (with ES5):

var listTitle = 'TestList', itemId = 1;

var ctx = new SP.ClientContext();
var item = ctx.get_web().get_lists().getByTitle(listTitle).getItemById(itemId);
ctx.load(item);
ctx.executeQueryAsync(function() {
  var properties = item.get_fieldValues().MetaInfo.trim();
  properties = properties.split(/\n/).filter(function(p) {
    return !!p;
  }).map(function(p) {
    p = p.split(/\|/);
    var t = p[0].split(/:/);
    return {
      name: t[0],
      type: t[1],
      value: p[1]
    };
  });
  console.log(properties);
});
  • Nice! SharePoint 2013 will make our lives easier, but this is neat. Didn't know MetaInfo contained all properties. – Dennis G Nov 11 '12 at 15:31
  • 1
    Me neither actually. What I did was to inspect the payload sent from server to see if my properties were actually sent at all. Then I noticed that they were contained in MetaInfo. – eirikb Nov 11 '12 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.