Forum Discussion

Aleksei Terentiev's avatar
Aleksei Terentiev
Copper Contributor
Dec 06, 2017

JSOM/REST Set List Item Property Bag Value

Hi all!

 

Is there a way to set List Item Property Bag value using JavaScript Object Model or REST API?

 

I've tried to use the approach that works fine for Web and List (Root folder) property bags:

var ctx = SP.ClientContext.get_current(); 
var web = ctx.get_web(); 
var list = web.get_lists().getByTitle('import test');
var item = list.getItemById(1);
ctx.load(item);
ctx.executeQueryAsync(function() {
var props = item.get_properties();
props.set_item('test', 'test');
item.update();
ctx.executeQueryAsync();
});

But if you then refresh the page and get list item's properties again, the new key-value won't be there.

There are no errors in the response of executeQueryAsync...

No RepliesBe the first to reply

Resources