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– Hugh Wood2012-08-21 18:52:52 +00:00Commented Aug 21, 2012 at 18:52
-
With soap you mean the SP webservices?Dennis G– Dennis G2012-08-21 19:27:32 +00:00Commented Aug 21, 2012 at 19:27
Add a comment
|
1 Answer
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– Dennis G2012-11-11 15:31:36 +00:00Commented Nov 11, 2012 at 15:31
-
1Me 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– eirikb2012-11-11 16:29:35 +00:00Commented Nov 11, 2012 at 16:29