IntroductionIn this article you will see how to get the content type by id in SharePoint 2010 using ECMAScript. I have a content type named "Custom Content Type" that belongs to "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 getContentTypebyId() { 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_name()) }
function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }</script> <input id="btnGetContentTypebyId" onclick="getContentTypebyId()" type="button" value="Get content type by Id" />
ReferenceSP.ContentTypeCollection.getbyid Property - http://msdn.microsoft.com/en-us/library/ee659536.aspx SummaryIn this article you have seen how to get the content type by id in SharePoint 2010 using ECMAScript.
Get The Content Type Group For The Specified Content Type in SharePoint 2010 Using ECMAScript
Create Custom Content Type in SharePoint 2010 Using ECMAScript
Hi,You may also check how to send SMS from Sharepoint with Ozeki NG SMS Gateway: http://www.sms-integration.com/p_17-sharepoint-sms.htmlBR
Hi Vijai. You have presented your article very nicely. Thanks for sharing it.
Keep posting more....
This is considerately.