public static function createNewDiscussion(SPList $list, $title)
    {
        $discussionPayload = array(
            "Title" => $title,
            "FileSystemObjectType" => 1
        );
        $item = $list->addItem($discussionPayload);
        $item->getContext()->executeQuery();
        //fix discussion folder name
        $item->setProperty("FileLeafRef",$title);
        $item->update();
        $item->getContext()->executeQuery();
        return $item;
    }
public static function createNewDiscussion(SPList $list, $title)
    {
        $discussionPayload = array(
            "Title" => $title,
            "FileSystemObjectType" => 1
        );
        $item = $list->addItem($discussionPayload);
        $item->getContext()->executeQuery();
        //fix discussion folder name
        $item->setProperty("FileLeafRef",$title);
        $item->update();
        $item->getContext()->executeQuery();
        return $item;
    }
public static function createNewDiscussion ( SPList $ list , $ title ) { $ discussionPayload = array ( "Title" => $ title , "FileSystemObjectType" => 1 ) ; $ item = $ list -> addItem ( $ discussionPayload ) ; $ item -> getContext ( ) -> executeQuery ( ) ; //fix discussion folder name $ item -> setProperty ( "FileLeafRef" , $ title ) ; $ item -> update ( ) ; $ item -> getContext ( ) -> executeQuery ( ) ; return $ item ; }
Creates a discussion item in Discussion Board
@param SPList $list
@param string $title
@return ListItem
@throws \Exception
Creates a discussion item in Discussion Board