SharePoint Get Content Types using SP.ClientContext



<script type="text/ecmascript">

function getWebProperties() {   var ctx = new SP.ClientContext.get_current();

if (ctx != undefined && ctx != null) {

this.web = ctx.get_web();

ctx.load(this.web);   ctx.executeQueryAsync(Function.createDelegate(this, this.onSuccess),    Function.createDelegate(this, this.onFail));   }  }  function onSuccess(sender, args) {     var cTypeColl =  this.web.get_contentTypes();

if (cTypeColl != undefined && cTypeColl != null) {         alert('Get Content Types!');     }

var cFields = SP.ContentType.get_fields();

if (cFields != undefined && cFields != null) {         alert('Get Fields!');     }

alert('web title:' + this.web.get_title() + '\n ID:' + this.web.get_id() +    '\n Created Date:' + this.web.get_created());  }  function onFail(sender, args) {   alert('failed to get list. Error:'+args.get_message());  }

</script>

Tagged with:
Posted in 2010, Microsoft SharePoint Server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Antek Group Blog
Categories
%d bloggers like this: