0

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.load(this.listItem);
                 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);

    }
3
  • 1
    What is your question? Commented Aug 29, 2014 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
    Commented Aug 29, 2014 at 13:45
  • Please include this information into the question. Commented Aug 29, 2014 at 14:15

1 Answer 1

1

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

1
  • 1
    If this completely solves your problem, please mark your answer as accepted. Commented Aug 29, 2014 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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