src/Thybag/SharePointAPI.php
public function read ($list_name, $limit = NULL, $query = NULL, $view = NULL, $sort = NULL, $options = NULL) {
		// Check limit is set
		if ($limit < 1 || is_null($limit)) {
			$limit = $this->MAX_ROWS;
		}

		// Create Query XML is query is being used
		$xml_options = '';
		$xml_query   = '';
		$fields_xml = '';

		// Setup Options
		if ($query instanceof Service\QueryObjectService) {
			$xml_query = $query->getCAML();
			$xml_options = $query->getOptionCAML();
		} else {

			if (!is_null($query)) {
				$xml_query .= $this->whereXML($query); // Build Query
			}
			if (!is_null($sort)) {
				$xml_query .= $this->sortXML($sort);// add sort
			}

			// Add view or fields
			if (!is_null($view)){
				// array, fields have been specified
				if(is_array($view)){
					$xml_options .= $this->viewFieldsXML($view);
				}else{
					$xml_options .= '<viewName>' . $view . '</viewName>';
				}
			}
		}

		// If query is required
		if (!empty($xml_query)) {
			$xml_options .= '<query><Query>' . $xml_query . '</Query></query>';
		}

		/*
		 * Setup basic XML for querying a SharePoint list.
		 * If rowLimit is not provided SharePoint will default to a limit of 100 items.
		 */
		$CAML = '
			<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
				<listName>' . $list_name . '</listName>
				<rowLimit>' . $limit . '</rowLimit>
				' . $xml_options . '
				<queryOptions xmlns:SOAPSDK9="http://schemas.microsoft.com/sharepoint/soap/" >
					<QueryOptions>
						' . $options . '
					</QueryOptions>
				</queryOptions>
			</GetListItems>';

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

		// Attempt to query SharePoint
		try {
			$result = $this->xmlHandler($this->soapClient->GetListItems($xmlvar)->GetListItemsResult->any);
		} catch (\SoapFault $fault) {
			$this->onError($fault);
		}

		// Return a XML as nice clean Array
		return $result;
	}
public function read ($list_name, $limit = NULL, $query = NULL, $view = NULL, $sort = NULL, $options = NULL) {
		// Check limit is set
		if ($limit < 1 || is_null($limit)) {
			$limit = $this->MAX_ROWS;
		}

		// Create Query XML is query is being used
		$xml_options = '';
		$xml_query   = '';
		$fields_xml = '';

		// Setup Options
		if ($query instanceof Service\QueryObjectService) {
			$xml_query = $query->getCAML();
			$xml_options = $query->getOptionCAML();
		} else {

			if (!is_null($query)) {
				$xml_query .= $this->whereXML($query); // Build Query
			}
			if (!is_null($sort)) {
				$xml_query .= $this->sortXML($sort);// add sort
			}

			// Add view or fields
			if (!is_null($view)){
				// array, fields have been specified
				if(is_array($view)){
					$xml_options .= $this->viewFieldsXML($view);
				}else{
					$xml_options .= '<viewName>' . $view . '</viewName>';
				}
			}
		}

		// If query is required
		if (!empty($xml_query)) {
			$xml_options .= '<query><Query>' . $xml_query . '</Query></query>';
		}

		/*
		 * Setup basic XML for querying a SharePoint list.
		 * If rowLimit is not provided SharePoint will default to a limit of 100 items.
		 */
		$CAML = '
			<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
				<listName>' . $list_name . '</listName>
				<rowLimit>' . $limit . '</rowLimit>
				' . $xml_options . '
				<queryOptions xmlns:SOAPSDK9="http://schemas.microsoft.com/sharepoint/soap/" >
					<QueryOptions>
						' . $options . '
					</QueryOptions>
				</queryOptions>
			</GetListItems>';

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

		// Attempt to query SharePoint
		try {
			$result = $this->xmlHandler($this->soapClient->GetListItems($xmlvar)->GetListItemsResult->any);
		} catch (\SoapFault $fault) {
			$this->onError($fault);
		}

		// Return a XML as nice clean Array
		return $result;
	}
public function read ( $ list_name , $ limit = NULL , $ query = NULL , $ view = NULL , $ sort = NULL , $ options = NULL ) { // Check limit is set if ( $ limit < 1 || is_null ( $ limit ) ) { $ limit = $ this -> MAX_ROWS ; } // Create Query XML is query is being used $ xml_options = '' ; $ xml_query = '' ; $ fields_xml = '' ; // Setup Options if ( $ query instanceof Service \ QueryObjectService ) { $ xml_query = $ query -> getCAML ( ) ; $ xml_options = $ query -> getOptionCAML ( ) ; } else { if ( ! is_null ( $ query ) ) { $ xml_query .= $ this -> whereXML ( $ query ) ; // Build Query } if ( ! is_null ( $ sort ) ) { $ xml_query .= $ this -> sortXML ( $ sort ) ; // add sort } // Add view or fields if ( ! is_null ( $ view ) ) { // array, fields have been specified if ( is_array ( $ view ) ) { $ xml_options .= $ this -> viewFieldsXML ( $ view ) ; } else { $ xml_options .= '<viewName>' . $ view . '</viewName>' ; } } } // If query is required if ( ! empty ( $ xml_query ) ) { $ xml_options .= '<query><Query>' . $ xml_query . '</Query></query>' ; } /*
		 * Setup basic XML for querying a SharePoint list.
		 * If rowLimit is not provided SharePoint will default to a limit of 100 items.
		 */ $ CAML = '
			<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
				<listName>' . $ list_name . '</listName>
				<rowLimit>' . $ limit . '</rowLimit>
				' . $ xml_options . '
				<queryOptions xmlns:SOAPSDK9="http://schemas.microsoft.com/sharepoint/soap/" >
					<QueryOptions>
						' . $ options . '
					</QueryOptions>
				</queryOptions>
			</GetListItems>' ; // Ready XML $ xmlvar = new \ SoapVar ( $ CAML , XSD_ANYXML ) ; $ result = NULL ; // Attempt to query SharePoint try { $ result = $ this -> xmlHandler ( $ this -> soapClient -> GetListItems ( $ xmlvar ) -> GetListItemsResult -> any ) ; } catch ( \ SoapFault $ fault ) { $ this -> onError ( $ fault ) ; } // Return a XML as nice clean Array return $ result ; }
Read
Use's raw CAML to query sharepoint data

@param String $list_name
@param int $limit
@param Array $query
@param String (GUID) $view "View to display results with."
@param Array $sort
@param String $options "XML string of query options."

@return Array
Read Use s raw CAML to query sharepoint data