Programmatically get list content types Client object model
Here is a short example of how to list content types associated with a list using Client Object model.
var _clientContext = new SP.ClientContext.get_current();
var _web = _clientContext.get_web();
var _list = _web.get_lists().getById(SP.ListOperation.Selection.getSelectedList());
var _ListCTColl = _list.get_contentTypes();
_clientContext.load(_list,'Title', 'Id');
_clientContext.load(_ListCTColl);
_clientContext.executeQueryAsync(Function.createDelegate(this, onListLoaded),
var _clientContext = new SP.ClientContext.get_current();
var _web = _clientContext.get_web();
var _list = _web.get_lists().getById(SP.ListOperation.Selection.getSelectedList());
var _ListCTColl = _list.get_contentTypes();
_clientContext.load(_list,'Title', 'Id');
_clientContext.load(_ListCTColl);
_clientContext.executeQueryAsync(Function.createDelegate(this, onListLoaded),
0 comments:
Post a Comment