Skip to main content
deleted 10 characters in body
Source Link
Michael Colbs
  • 3.9k
  • 3
  • 49
  • 98

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(appwebUrl) {
     var clientContext = new SP.ClientContext(appwebUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(appwebUrl) {
     var clientContext = new SP.ClientContext(appwebUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(appwebUrl) {
     var clientContext = new SP.ClientContext(appwebUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, onQuerySucceeded),
        Function.createDelegate(this, onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?

added 4 characters in body
Source Link
Michael Colbs
  • 3.9k
  • 3
  • 49
  • 98

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(siteUrlappwebUrl) {
     var clientContext = new SP.ClientContext(siteUrlappwebUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(siteUrl) {
     var clientContext = new SP.ClientContext(siteUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(appwebUrl) {
     var clientContext = new SP.ClientContext(appwebUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?

Source Link
Michael Colbs
  • 3.9k
  • 3
  • 49
  • 98

Create List Item SharePoint Hosted App

I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.

function createListItem(siteUrl) {
     var clientContext = new SP.ClientContext(siteUrl);
     var oList =   clientContext.get_web().get_lists().getByTitle('CustomList');

     var itemCreateInfo = new SP.ListItemCreationInformation();
     this.oListItem = oList.addItem(itemCreateInfo);
     oListItem.set_item('Title', 'My New Item!');
     oListItem.set_item('CustomField Text', 'Hello World!');
     oListItem.update();

     clientContext.load(oListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded),
        Function.createDelegate(this, this.onQueryFailed)
   );
}


 function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());
 }

 function onQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() +
    '\n' + args.get_stackTrace());
}

I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?