Camelot PHP Tools for SharePoint

Selecting data from SharePoint with SQL

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

Bendsoft Camelot PHP Tools is a versatile collection of PHP classes that enable seamless integrations between PHP and SharePoint through the Camelot .NET Connector.

A glimpse of Camelot PHP Tools 2.0

» Read the article in our blog

 

PHPTools Download _Medium

 

Read list data from SharePoint directly in your PHP application, including custom lists and document libraries. The possibilities are limitless.

Camelot PHP Tools extends the power of the Camelot .NET Connector to the PHP world. It enables easy access to SharePoint data like list items and documents. Allowing developers to work with well-known ADO.NET framework and SQL speeds up the development process and uplift the production quality

1-2-3. Install - Connect – Select
Install-connect-select.png

or insert, update and delete

Developers can now connect their PHP applications to SharePoint using SQL, just as if it was an ordinary database. Camelot PHP Tools handles both predefined lists like the 'Calendar' and the 'Task list' but also custom lists and custom document libraries.

The ideal SharePoint companion

Camelot PHP Tools saves time when integrating with SharePoint

  • Easy installation, simply include the library files and set up your connection settings to the Camelot SharePoint Integration Service and you are done
  • Complete handling of
    • Custom list items, create any list you want and you will be able to handle it instantly
    • Predefined list items like the Tasks list and Calendar
    • Documents, folders and document libraries
    •  Store data in database or read dynamically through the Camelot SharePoint Integration Service.

Benefits

Supporting-custom-lists.pngWith Camelot PHP Tools developers can work faster and create better and more flexible solutions. Since all in- and output from SharePoint is transformed into the well-known database computer language SQL (Structured Query Language) the development process becomes normalized. This brings opportunities to developers working with SharePoint list data and document libraries with no prior knowledge of SharePoint development or SharePoint integrations with PHP.

  • Lower the threshold of required knowledge when working with SharePoint data and integrations.
  • Enhance productivity for developers
  • Reduce maintenance costs
  • Less special training of developers
  • Easier to support data connectivity

Features

You query SharePoint as if it was a regular database through the Camelot SharePoint Integration Service. It doesn't matter if you are selecting from a default list, a modified version of a default list or from a custom list or document library, Camelot PHP Tools for SharePoint will retrieve the data and make it available to your needs. Among others you can

  • Select explicit columns (SELECT Id,Title FROM customList)
  • Select everything (SELECT * FROM customList, add the .all to the list name to fetch every element available from the list)
  • Select by view (SELECT * FROM customList.viewName)

Camelot PHP Tools offers real CRUD (create, read, update and delete) support and beyond using SQL syntax and stored procedures.

Features include complete handling of List items – Select, Insert, Update and Delete – and handling of document libraries and their items (folders and documents).

Se samples below

Selecting, Inserting, Updating and Deleting

Selecting data from SharePoint with SQL

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

Selecting data from SharePoint by list and view name

$SharePointQuery = new SharePointQuery(
    array(
        'listName' => 'Tasks',
        'viewName' => 'All Tasks',
        'includeAttachements' => false,
        'connection_name' => 'SharePointConnection1',
        'columns' => ''
    )
);

Insert data in SharePoint with SQL and SharePointNonQuery

$SharePointNonQuery = new SharePointNonQuery(array(
    'sql' => "INSERT INTO Tasks (Title,AssignedTo,Status,Priority,DueDate,PercentComplete) VALUES ('Test task from PHP',1,'In Progress','(1) High', '".  date('Y-m-d H:i:s') ."',0.95)",
    'method' => 'ExecuteNonQuery',
    'connection_name' => 'SharePointConnection1'
));

Delete data in SharePoint with SQL and SharePointNonQuery

$SharePointNonQuery = new SharePointNonQuery(array(
    'sql' => "DELETE FROM Tasks WHERE Title = 'Test task from PHP (updated)' OR Title = 'Test task from PHP'",
    'method' => 'ExecuteNonQuery',
    'connection_name' => 'SharePointConnection1'
));

Update data in SharePoint with SQL and SharePointNonQuery

$SharePointNonQuery = new SharePointNonQuery(array(
    'sql' => "UPDATE Tasks SET Title = 'Test task from PHP (updated)' WHERE PercentComplete = 0.95 AND TITLE = 'Test task from PHP'",
    'method' => 'ExecuteNonQuery',
    'connection_name' => 'SharePointConnection1'
));

 

Document handling

File Download

if (!isset($_GET["file"]) || $_GET["file"] == "") {
    echo '<p>You must state a file to download. Ex 
          wcf_download.php?file=notes.docx or by using the form below.</p>';
    echo '<form method="get">File name: <input type="text" name="file" /> 
          <input type="submit"></form>';
    die();
}

// Load all required files for Camelot PHP Tools
require_once 'loader.php';

try {
    $download = new CamelotDownloadFile(array(
                "file" => $_GET["file"],
                "listName" => 'Shared Documents',
                "connection_name" => 'SharePointConnection1'
            ));

    $download->download_file();
} catch (Exception $exc) {
    echo "<h2>Method unsuccessful :(</h2><ul><ol>Did you set up settings.php?</ol><ol>Check the argument array</ol></ul>";
    echo $exc->getTraceAsString();
}

File Upload

// Load all required files for Camelot PHP Tools
require_once 'loader.php';

// Handle upload files
if ($_SERVER['REQUEST_METHOD'] == "POST") {

    try {
        $UploadFile = new CamelotUploadFile(array(
                    "file" => $_FILES,
                    "listName" => 'Shared Documents',
                    "connection_name" => 'SharePointConnection2'
                ));

        if ($UploadFile->result) {
            echo $UploadFile->message;
        } else {
            echo $UploadFile->result;
            echo $UploadFile->message;
        }
    } catch (Exception $exc) {
        echo "<h2>Method unsuccessful :(</h2><ul><ol>Did you set up settings.php?</ol><ol>Check the argument array</ol></ul>";
        echo $exc->getTraceAsString();
    }
}

Upload Form

<form action="wcf_upload.php" method="post" enctype="multipart/form-data">
    Choose a file to upload: <input type="file" name="file" id="file" /> <br />
    <input type="submit" value="Upload File" />
</form>

Camelot XML is a standardized format that encapsulates the complex structure of SharePoint list data into simple XML format. It is ideal for storing and transferring SharePoint list and document library data. It may contain a schema definition as well as a general list description and can be easily read in any programming language. 

It also contains all the exported list rows and the schema of the exported content. These are all necessary parts to be able to use this information in a remote system, in example

  • PHP based applications
  • Objective-C applications (iPhone, iPad or OS X)
  • Java applications
  • Ruby applications
  • Python applications

 

Visa     MasterCard