Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

1 Answer 1

up vote 2 down vote accepted

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;
  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);
});
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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