IntroductionIn this article you will see how to get the content type group for the specified content type in SharePoint 2010 using ECMAScript. I have a content type named "Custom Content Type" that belongs to a "Custom Content Types" group (Navigate to the site, click on Site Actions. Click on Site Settings. In the Galleries section, click on Site Content Types). Steps Involved
var contentTypeCollection; var contentType;
function getContentTypeGroup() { var clientContext = new SP.ClientContext.get_current(); if (clientContext != undefined && clientContext != null) { var web = clientContext.get_web(); this.contentTypeCollection = web.get_contentTypes(); this.contentType = contentTypeCollection.getById("0x0100FFC434A461E47E4EB81D3FD76D42BFBF"); clientContext.load(this.contentType); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); } }
function onQuerySucceeded() { alert(this.contentType.get_group()) }
function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }</script> <input id="btnGetContentTypeGroup" onclick="getContentTypeGroup()" type="button" value="Get the content type group" />
ReferenceSP.ContentTypeCollection.group Property - http://msdn.microsoft.com/en-us/library/ee547095.aspx SummaryThus in this article you have seen how to get the content type group for the specified content type in SharePoint 2010 using ECMAScript.
Configuring Outgoing Email Sharepoint 2010
Get The Content Type by id in SharePoint 2010 Using ECMA Script
Hi Vijai. Nicely presented article.
Thanks sam.
Really your explanation is very nice.
The ECMAScript Language Specification Standard is at http://www.ecma-international.org/publications/standards/Ecma-262.htm. Note that it uses "ECMAScript" not "ECMA Script" with a space, therefore I think it is appropriate to use ECMAScript.