IntroductionIn this article you will see how to get the list content types in SharePoint 2010 using ECMAScript. I have a list named "List Request" which has the following content types (Navigate to the list, click on List tab in the ribbon interface. Click on List Settings button).
Steps Involved
function onQuerySucceeded() { var contentType = 'List Content Types:\n ' var contentTypeEnumerator = this.contentTypeCollection.getEnumerator();
while (contentTypeEnumerator.moveNext()) { var content = contentTypeEnumerator.get_current(); contentType += content.get_name() + '\n'; } alert(contentType); }
function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
ReferenceSP.List.contentTypes Property - http://msdn.microsoft.com/en-us/library/ee556719.aspx SummaryThus in this article you have seen how to get the list content types in SharePoint 2010 using ECMAScript.