ECMAScript to read specific custom properties of library and based on the property value delete the item.

   var itemId = 43;
             function filldata() {
                 var clientContext = new SP.ClientContext.get_current();
                 this.web = clientContext.get_web();
                 var list = web.get_lists().getByTitle("doc lib name");
                 this.listItem = list.getItemById(itemId);
                 // clientContext.load(this.listItem, 'Include(Id, Description,Publih Date)'); //error message properties Description,PublihDate not available.
                 clientContext.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFail));

     function onSuccess(sender, args) {

                 var value = this.listItem.get_item("Title");  // Getting only ID , title .
     var value = this.listItem.get_item("Description"); // error like below
    var value = this.listItem.get_item("Publih Date");// error like below
                alert("value" + value);

  • 1
    What is your question? – Robert Lindgren Aug 29 '14 at 12:55
  • For Description ,PublishedDate raising error like:- The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested. – Ganesha Aug 29 '14 at 13:45
  • Please include this information into the question. – Andrey Markeev Aug 29 '14 at 14:15

This is internal names issue. Description filed internal name is Description0, Publih Date field name is Publih_x0020_Date.

| improve this answer | |
  • 1
    If this completely solves your problem, please mark your answer as accepted. – Andrey Markeev Aug 29 '14 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.