Академический Документы
Профессиональный Документы
Культура Документы
SharePoint
info@bendsoft.com
www.bendsoft.com
COPYRIGHT
Copyright 2010 Bendsoft. All rights reserved.
Bendsoft reserves the right to make changes to software and documentation without notice.
For the most recent version of documentation, visit the Bendsoft web site at
www.bendsoft.com.
PROPRIETARY NOTICES
Bendsoft is a trademark of Bendsoft
Microsoft, SharePoint and Microsoft Office SharePoint Server are trademarks of Microsoft,
Inc. All other trademarks are the property of their respective owners.
ISSUE DATE: October 2010
Table of Contents
Preface..........................................................................................................................................................................5
Intended audience....................................................................................................................................................5
Prerequisites.............................................................................................................................................................5
Introduction to Bendsoft Camelot PHP Tools..........................................................................................................6
Brief technology overview......................................................................................................................................6
Camelot .NET Connector for Microsoft SharePoint.........................................................................................6
Licensing............................................................................................................................................................6
Camelot .NET Connector.............................................................................................................................6
Camelot PHP Tools.......................................................................................................................................6
Other Bendsoft Products...............................................................................................................................6
A quick overview of example usage.......................................................................................................................6
Simple List Synchronisation.........................................................................................................................7
Insert data from a web form to a SharePoint list..........................................................................................7
Setting up a database..................................................................................................................................................8
Tables.......................................................................................................................................................................8
camelot_dump....................................................................................................................................................8
Setting up......................................................................................................................................................8
camelot_list........................................................................................................................................................8
Setting up......................................................................................................................................................8
camelot_content.................................................................................................................................................9
Setting up......................................................................................................................................................9
Classes..........................................................................................................................................................................9
ORM........................................................................................................................................................................9
Package receiving..................................................................................................................................................10
Package handling...................................................................................................................................................10
Package reading.....................................................................................................................................................10
Packets........................................................................................................................................................................10
Requirements.........................................................................................................................................................10
Schema and content packets..................................................................................................................................11
Schemas......................................................................................................................................................11
Example schema....................................................................................................................................11
Sorting order..........................................................................................................................................12
Content........................................................................................................................................................12
Example content....................................................................................................................................12
Storing...................................................................................................................................................................13
Examples and Tutorials............................................................................................................................................13
Preface
This documentation explains how to use Bendsoft Camelot PHP Tools along with Camelot
.NET Connector for Microsoft SharePoint. It describes basic handling, available classes and
provides usage examples.
Note! You need a valid Bendsoft Camelot .NET Connector License to use the PHP Tools. Check
the prerequisites chapter for further information.
Intended audience
This guide is intended for developers. Depending on the functionality to be used, readers
should have specific knowledge in the following areas:
Object Oriented PHP development
SOAP
Basic knowledge of Microsoft Office SharePoint Server (MOSS) data structure
Camelot .NET Connector for Microsoft SharePoint
SQL
XML
Prerequisites
To use Bendsoft Camelot PHP Tools you need
Microsoft Office SharePoint Server (MOSS)
(http://sharepoint.microsoft.com/)
A Bendsoft Camelot .NET Connector License
(http://www.bendsoft.com/licensing/)
Bendsoft Camelot Synchronisation Service
(Free tool, available at http://www.bendsoft.com/downloads/)
AND/OR
Bendsoft Content Dump Generator Web Part
(Free tool, available at http://www.bendsoft.com/downloads/)
A web server capable of running PHP5 source code
- Apache2 recommended (http://www.apache.org)
MySQL Server (5.x)
(http://www.mysql.com)
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
Licensing
Camelot .NET Connector
The Camelot .NET Connector is not free or anywise included in any free licensing. License
agreements can be found at http://www.bendsoft.com/licensing/.
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
Setting up a database
The current version Camelot PHP Tools only supports MySQL. We are developing support
for other databases, PostgreSQL among others.
Tables
Since Camelot PHP Tools utilise XML structure for synchronised list data the table structure
becomes rather easy and straight forward.
In this version there are three tables.
camelot_dump
camelot_list
camelot_content
camelot_dump
The camelot_dump table contains the actual dump packets from Camelot .NET Connector,
you can read more about packets in the Packets section.
Setting up
CREATE TABLE `camelot_dump` (
`camelot_dump_id` bigint(20) NOT NULL auto_increment,
`camelot_dump_packet` longtext NOT NULL,
`camelot_dump_ip` varchar(255) default NULL,
`camelot_dump_date` datetime default NULL,
`camelot_dump_packet_md5` varchar(255) default NULL,
PRIMARY KEY (`camelot_dump_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
Note! Use your preferred ENGINE and AUTO_INCREMENT start parameters.
camelot_list
The camelot_list table contains the disaggregated MOSS lists and it's schema.
Setting up
CREATE TABLE `camelot_list` (
`camelot_list_id` int(11) NOT NULL auto_increment,
`camelot_list_id_external` varchar(255) NOT NULL,
`camelot_list_title` varchar(255) default NULL,
`camelot_list_description` text,
`camelot_list_schema` longtext,
`camelot_list_date_modified` datetime default NULL,
`camelot_list_date_lastdeleted` datetime default NULL,
`camelot_list_date_created` datetime default NULL,
`camelot_list_itemcount` int(11) default NULL,
`camelot_list_ip` varchar(255) default NULL,
`camelot_list_status` tinyint(4) default NULL,
PRIMARY KEY (`camelot_list_id`)
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
9
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
Note! Use your preferred ENGINE and AUTO_INCREMENT start parameters.
camelot_content
The camelot_content contains the actual rows of the list.
Setting up
CREATE TABLE `camelot_content` (
`camelot_content_id` int(11) NOT NULL auto_increment,
`camelot_content_camelot_list_id` int(11) default NULL,
`camelot_content_camelot_list_id_external` varchar(255) default NULL,
`camelot_content_row_index` varchar(255) default NULL,
`camelot_content_content` longtext,
PRIMARY KEY (`camelot_content_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
Note! Use your preferred ENGINE and AUTO_INCREMENT start parameters.
Classes
The PHP Classes are built to be agile and simple since the fields of usage isn't really defined
and that we like to keep this project open and emphasise the possibilities for creative
solutions. Feel free to leave suggestions and improvements to phptools@bendsoft.com.
The classes are separated in the following pattern
ORM databases and tables.
Receiving packages
Handling of packages
Read and output data
ORM
This version contains four main database classes
Db
CamelotDump
CamelotList
CamelotContent
Class name
File
Information
Db
db.php
CamelotDump
tbl.dump.php
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
10
CamelotList
tbl.list.php
CamelotContent
tbl.content.php
Package receiving
Class to handle the insert of SharePoint data from the Camelot .NET Connector
Class name
File
Information
PacketReceiver
class.packet.receiver.php
Extends CamelotDump
Package handling
These classes are used to decode, insert and handle dump data
Class name
File
Information
DecodeDump
class.packet.handler.php
Extends CamelotDump
InsertList
class.packet.handler.php
Extends CamelotList
InsertContent
class.packet.handler.php
Extends CamelotContent
Package reading
These classes are used to read and format inserted data
Class name
File
Information
SharePointListReader
class.packet.reader.php
Extends CamelotList
SharePointContentReader
class.packet.reader.php
Extends CamelotContent
Packets
Requirements
As of this version the Camelot PHP Tools only reads assembled packets from either the
Camelot Synchronisation Service or the Dump Generator Web Part.
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
11
</Schema>
<Content>
</Content>
</Packet>
Schemas
Schemas contains in-depth information about each field represented in the list view.
Example schema
<Field Name="ContentType">
<ID>c042a256-787d-4a6f-8a8a-cf6ab767f12d</ID>
<DisplayName>Content Type</DisplayName>
<Type>Text</Type>
<Required>False</Required>
<ReadOnly>True</ReadOnly>
<PrimaryKey>False</PrimaryKey>
<Percentage>False</Percentage>
<RichText>False</RichText>
<VisibleInView>True</VisibleInView>
<AppendOnly>False</AppendOnly>
<FillInChoice>False</FillInChoice>
<HTMLEncode>False</HTMLEncode>
<Mult>False</Mult>
<Filterable>True</Filterable>
<Sortable>True</Sortable>
<Group>_Hidden</Group>
</Field>
<Field Name="Title">
<ID>fa564e0f-0c70-4ab9-b863-0177e6ddd247</ID>
<DisplayName>Title</DisplayName>
<Type>Text</Type>
<Required>True</Required>
<ReadOnly>False</ReadOnly>
<PrimaryKey>False</PrimaryKey>
<Percentage>False</Percentage>
<RichText>False</RichText>
<VisibleInView>True</VisibleInView>
<AppendOnly>False</AppendOnly>
<FillInChoice>False</FillInChoice>
<HTMLEncode>False</HTMLEncode>
<Mult>False</Mult>
<Filterable>True</Filterable>
<Sortable>True</Sortable>
</Field>
<Field ...
12
http://msdn.microsoft.com/en-us/library/dd588183(office.11).aspx.
The Camelot .NET Connector specific field types are available in the SPC documentation
http://www.bendsoft.com/#/camelot.
Sorting order
By default the sorting order of the SharePoint list view is kept in the schema and each list
view has its own schema. All output through the PHP Tools are based on this rule, if you wish
to change the sorting order the most simple and logic way to do so is to change the sorting
order in SharePoint before exporting the data or to rearrange the fields in the schemas
(camelot_list.camelot_list_schemas).
Content
All content is stored in a similar manner as the schemas but only contain the content fields.
Example content
<Row Index="0">
<ContentType>Item</ContentType>
<Title>First article</Title>
<Ingress>...</Ingress>
<Article>...</Article>
<Start_x0020_publish>2010-05-14 22:00:00</Start_x0020_publish>
<Stop_x0020_publish/>
<Publish_x0020_to_x0020_external_>true</Publish_x0020_to_x0020_external
_>
</Row>
<Row Index="1">
<ContentType>Item</ContentType>
<Title>Dorum lorom</Title>
<Ingress>...</Ingress>
<Article>...</Article>
<Start_x0020_publish>2010-05-15 13:00:00</Start_x0020_publish>
<Stop_x0020_publish/>
<Publish_x0020_to_x0020_external_>true</Publish_x0020_to_x0020_external
_>
</Row>
<Row Index="2">
<ContentType>Item</ContentType>
<Title>...</Title>
<Ingress>...</Ingress>
<Article/>
<Start_x0020_publish>2010-05-05 10:00:00</Start_x0020_publish>
<Stop_x0020_publish>2010-06-05 00:00:00</Stop_x0020_publish>
<Publish_x0020_to_x0020_external_>true</Publish_x0020_to_x0020_external
_>
</Row>
Note! All text content are escaped (external entities, xml-secure).
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
13
Storing
PHP Tools stores packets in the camelot_dump table. Use the PacketReceiver class to
store packets.
For further examples, see the Receiving SharePoint Data section in Examples and Tutorials.
Example packages
We have several example packets available for download at
http://www.bendsoft.com/#/downloads/phptools
14
print_r($packet);
?>
The packet has now been decoded and have turned into a SimpleXMLElement Object and can
be processed with normal property selectors and array iterators.
Note! This does not insert anything in the database, it only read and decode data from the
camelot_dump table in the database.
This action separates the packet to the tables camelot_list and camelot_content. You are
allowed to insert the same list more than once. The latest inserted version is always marked as
active in the camelot_list.camelot_list_status field.
Note! To perform this operation you must set up the camelot_list and camelot_content tables as
described in this documentation.
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
15
'list_header' => $lists->_headers,
'list_content' => $lists->_content
));
?>
Note! This only lists the available lists, not the content data.
Variants
The show_lists method is versatile and supports the most obvious selections by default. The
method looks like this
/**
* Function to show lists with some preselected data
*
* @access
public
* @param int|string $id Optional, if stated as int it selects the
camelot_list_id, if string it selects the camelot_list_id_external
(SharePoint Guid)
* @param int $status Can be 1, 0 or not stated (null). 1 means currently
active, 0 is all inactive and if not stated ($status = '') all items are
selected
* @return object
*/
function show_lists($id = null, $status = 1) {
As of this version you can make selections based on id or status. The id can either be an
integer or a SharePoint Guid.
Select the list item who has camelot_list_id 7, ignoring if it's active or not
$lists = $SharePointList->show_lists(7, null);
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
16
// State which template to use (sp2010.html, sp2007.html, ...)
$template = $twig->loadTemplate('sp2007.html');
// Send data to template
echo $template->render(array(
'list_header' => $list->_schema->display_name,
'list_content' => $list->_content
));
?>
Variants
The get_list_data method supplies a number of options. The method looks like this
/**
* Method to get list data
*
* @access public
* @param int|string $id Required, if stated as int it selects the
camelot_list_id, if string it selects the camelot_list_id_external
(SharePoint Guid)
* @param int $status Can be 1, 0 or not stated. 1 means currently
active, 0 is all inactive and if not stated ($status = '') all items are
selected
* @param string $columns What columns to show, semicolon separated
attribute_name. Default shows everything.
* @return object with data
*/
function get_list_data($id, $status = 1, $colums = null) {
As of this version you can make selections based on id or status and state which columns you
want to list. The id can either be an integer or a SharePoint Guid, the column names stated
must be the attribute_name.
To select the active list with SharePoint Guid a436e57e-5274-4375-a7fa-767f1160a52c and
list Title, Ingress, Article, and Start Publish simply state something like this
$list = $SharePointContent->get_list_data('a436e57e-5274-4375-a7fa767f1160a52c',1,'Title;Ingress;Article;Start_x0020_publish');
Information
Function
100
PacketReceiver.insert_packet
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com
17
Information
Function
200
DecodeDump.decode_packet
201
DecodeDump.get_packet
202
InsertList.insert_list
203
InsertContent.insert_content
204
InsertContent.insert_content
Information
Function
300
Bad Guid
SharePointListReader.show_lists
301
No data in list
SharePointContentReader.sort_content
302
SharePointContentReader.sort_content
303
Missing id or Guid
SharePointContentReader.get_schema
304
Missing id or Guid
SharePointContentReader.get_content
Camelot PHP Tools for Microsoft SharePoint - Documentation, Ver 1.0 RC1, www.bendsoft.com