public function addItem(array $listItemCreationInformation)
    {
        $items = new ListItemCollection($this->getContext(),
            new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"items"));
        $listItem = new ListItem($this->getContext());
        $listItem->parentCollection = $items;
        $listItem->setProperty('ParentList',$this,false);
        foreach($listItemCreationInformation as $key => $value){
            $listItem->setProperty($key,$value);
        }
        $qry = new CreateEntityQuery($listItem);
        $this->getContext()->addQuery($qry,$listItem);
        return $listItem;
    }
public function addItem(array $listItemCreationInformation)
    {
        $items = new ListItemCollection($this->getContext(),
            new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"items"));
        $listItem = new ListItem($this->getContext());
        $listItem->parentCollection = $items;
        $listItem->setProperty('ParentList',$this,false);
        foreach($listItemCreationInformation as $key => $value){
            $listItem->setProperty($key,$value);
        }
        $qry = new CreateEntityQuery($listItem);
        $this->getContext()->addQuery($qry,$listItem);
        return $listItem;
    }
public function addItem ( array $ listItemCreationInformation ) { $ items = new ListItemCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "items" ) ) ; $ listItem = new ListItem ( $ this -> getContext ( ) ) ; $ listItem -> parentCollection = $ items ; $ listItem -> setProperty ( 'ParentList' , $ this , false ) ; foreach ( $ listItemCreationInformation as $ key => $ value ) { $ listItem -> setProperty ( $ key , $ value ) ; } $ qry = new CreateEntityQuery ( $ listItem ) ; $ this -> getContext ( ) -> addQuery ( $ qry , $ listItem ) ; return $ listItem ; }
The recommended way to add a list item is to send a POST request to the ListItemCollection resource endpoint, as shown in ListItemCollection request examples.
@param array $listItemCreationInformation Creation information for a List item
@return ListItem List Item resource
The recommended way to add a list item is to send a POST request to the ListItemCollection resource endpoint as shown in ListItemCollection request examples .