Introducing Camelot PHP Tools 1.5

This release fixes a few minor errors in the previous release and introduces two new commands that we made available in the latest release of the Camelot SharePoint Integration Toolkit available at http://camelottoolkit.codeplex.com/. We always keep the documentation up to date, checkout http://docs.bendsoft.com/camelot-php-tools/latest/ for the latest version of the PHP Tools documentation.

The goodies in this update

  • ExecuteCount
  • ExecuteCamelotXmlLimit

View the changelog for complete details.

Counts

The counting method is reached through the SharePointQuery class by replacing the SQL argument name with count

$SharePointQuery = new SharePointQuery(array(
    'count' => "SELECT ID FROM Tasks Where ID > 10",
    'connection_name' => 'SharePointConnection1'
));
$recordCount = $SharePointQuery->CamelotSoap->_count;

Limits, or skip and take

The SharePoint API does not support offset in limit commands so we had to implement this in a separate method. This query looks like an ordinary SharePointQuery but we added skip and take parameters.

$SharePointQuery = new SharePointQuery(array(
    'sql' => "SELECT * FROM Tasks Where ID > 10",
    'connection_name' => "SharePointConnection1",
    'skip' => 7,
    'take' => 10
));

The above command would select stuff from the Tasks list and skip the first 7 result rows returning row 8 to 17.

A good way to use this is to first run a count to verify the amount of records available and then run the skip/take query

// Query arguments
$query = "SELECT * FROM Tasks Where ID > 10";
$connection = "SharePointConnection1";
$skip = 5;
$take = 4;

// Get the total amount of records
$CountQuery = new SharePointQuery(array(
    'count' => $query,
    'connection_name' => $connection
));

$recordCount = $CountQuery->CamelotSoap->_count;

// Cannot perform query, to many skips
if($skip > $recordCount){
    die("You cannot skip more records than available");
}

// The results are returned to the $SharePointQuery variable
$SharePointQuery = new SharePointQuery(array(
    'sql' => $query,
    'connection_name' => $connection,
    'skip' => $skip,
    'take' => $take
));

// Print the result
pr($SharePointQuery); // or print_r($SharePointQuery);

Let us know if you have any questions; also consider using the forums http://forum.bendsoft.com

Download Button

This entry was posted in SharePoint and tagged , . Bookmark the permalink.

2 Responses to Introducing Camelot PHP Tools 1.5

  1. Lanzkie says:

    Sorry for the noob question but where, exctaly, should I add this code? Which css should be modified?I’ve never modified a CSS before, so any links you could provide would be much appreciated.Thanks for the great write up on this problem.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>