Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand

How to create a List in SharePoint using Client Object Model?

Posted by Jean Paul on June 30, 2012

ClientContext clientContext = new ClientContext(“http://url”);

ListCreationInformation listCreationInformation = new ListCreationInformation();
listCreationInformation.Title = “New List Title”;
listCreationInformation.TemplateType = (int)ListTemplateType.Tasks;

list = clientContext.Web.Lists.Add(listCreationInformation);


2 Responses to “How to create a List in SharePoint using Client Object Model?”

  1. Vinu Kumaran said


    How to access datetime field of SharePoint list’s attribute inside a javascript function?

    I have a the datetime field “StartedOn”, how can I access the sharepoint datafield inside the javascript?

    I tried this by like this

    var ppe = document.getElementById(‘).value; (This is inside the Default.aspx page)

    But not working, any alternative will be much helpful.


    • Jean Paul said

      Hei Vinu Kumaran.. Nice to see you again my friend..

      You can try the following code as reference:

      function ReadListItem() {
      var listTitle = “Airports”;

      //Get the current client context
      context = SP.ClientContext.get_current();
      var airportList = context.get_web().get_lists().getByTitle(listTitle);

      var camlQuery = SP.CamlQuery.createAllItemsQuery();

      this.listItems = airportList.getItems(camlQuery);


      context.executeQueryAsync(ReadListItemSucceeded, ReadListItemFailed);

      function ReadListItemSucceeded(sender, args) {
      var itemsString = ”;
      var enumerator = listItems.getEnumerator();

      while (enumerator.moveNext()) {
      var listItem = enumerator.get_current();
      itemsString += ‘AirportName: ‘ + listItem.get_item(‘AirportName’) +
      ‘ AirportCode: ‘ + listItem.get_id().toString() + ‘\n’;


      function ReadListItemFailed(sender, args) {
      alert(‘Request failed. ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());

Leave a Reply

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

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

Google photo

You are commenting using your Google 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