src/Thybag/SharePointAPI.php
public function modifyList ($list_name, array $items, $method, $folderPath = null) {
		// Get batch XML
		$commands = $this->prepBatch($items, $method);

                $rootFolderAttr = '';
                if($folderPath != null && $folderPath != '/') {
                    $sitePath = substr($this->spWsdl, 0, strpos($this->spWsdl, '_vti_bin'));
                    $rootFolderAttr = ' RootFolder="'.$sitePath.$list_name.'/'.$folderPath.'"';
                }

		// Wrap in CAML
		$CAML = '
		<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
			<listName>' . $list_name . '</listName>
			<updates>
				<Batch ListVersion="1" OnError="Continue"'.$rootFolderAttr.'>
					' . $commands . '
				</Batch>
			</updates>
		</UpdateListItems>';

		$xmlvar = new \SoapVar($CAML, XSD_ANYXML);
		$result = NULL;

		// Attempt to run operation
		try {
			$result = $this->xmlHandler($this->soapClient->UpdateListItems($xmlvar)->UpdateListItemsResult->any);
		} catch (\SoapFault $fault) {
			$this->onError($fault);
		}

		// Return a XML as nice clean Array
		return $result;
	}
public function modifyList ($list_name, array $items, $method, $folderPath = null) {
		// Get batch XML
		$commands = $this->prepBatch($items, $method);

                $rootFolderAttr = '';
                if($folderPath != null && $folderPath != '/') {
                    $sitePath = substr($this->spWsdl, 0, strpos($this->spWsdl, '_vti_bin'));
                    $rootFolderAttr = ' RootFolder="'.$sitePath.$list_name.'/'.$folderPath.'"';
                }

		// Wrap in CAML
		$CAML = '
		<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
			<listName>' . $list_name . '</listName>
			<updates>
				<Batch ListVersion="1" OnError="Continue"'.$rootFolderAttr.'>
					' . $commands . '
				</Batch>
			</updates>
		</UpdateListItems>';

		$xmlvar = new \SoapVar($CAML, XSD_ANYXML);
		$result = NULL;

		// Attempt to run operation
		try {
			$result = $this->xmlHandler($this->soapClient->UpdateListItems($xmlvar)->UpdateListItemsResult->any);
		} catch (\SoapFault $fault) {
			$this->onError($fault);
		}

		// Return a XML as nice clean Array
		return $result;
	}
public function modifyList ( $ list_name , array $ items , $ method , $ folderPath = null ) { // Get batch XML $ commands = $ this -> prepBatch ( $ items , $ method ) ; $ rootFolderAttr = '' ; if ( $ folderPath != null && $ folderPath != '/' ) { $ sitePath = substr ( $ this -> spWsdl , 0 , strpos ( $ this -> spWsdl , '_vti_bin' ) ) ; $ rootFolderAttr = ' RootFolder="' . $ sitePath . $ list_name . '/' . $ folderPath . '"' ; } // Wrap in CAML $ CAML = '
		<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
			<listName>' . $ list_name . '</listName>
			<updates>
				<Batch ListVersion="1" OnError="Continue"' . $ rootFolderAttr . '>
					' . $ commands . '
				</Batch>
			</updates>
		</UpdateListItems>' ; $ xmlvar = new \ SoapVar ( $ CAML , XSD_ANYXML ) ; $ result = NULL ; // Attempt to run operation try { $ result = $ this -> xmlHandler ( $ this -> soapClient -> UpdateListItems ( $ xmlvar ) -> UpdateListItemsResult -> any ) ; } catch ( \ SoapFault $ fault ) { $ this -> onError ( $ fault ) ; } // Return a XML as nice clean Array return $ result ; }
modifyList
Perform an action on a sharePoint list to either update or add content to it.
This method will use prepBatch to generate the batch xml, then call the SharePoint SOAP API with this data
to apply the changes.

@param $list_name SharePoint List to update
@param $items Array of new items or item changesets.
@param $method New/Update/Delete
@return Array|Object
modifyList Perform an action on a sharePoint list to either update or add content to it . This method will use prepBatch to generate the batch xml then call the SharePoint SOAP API with this data to apply the changes .