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),

0 comments:

Post a Comment

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at sharepointprogrammingblogger@gmail.com .

Copyright (c) 2010 @ myshaepointwork.blogspot.com. All rights are reserved.Do Not Copy.

@ Learning SharePoint.com