通过 PHP 连接 Sharepoint 数据库

2021-12-23 00:00:00 connection database sharepoint php

我不熟悉 Sharepoint.我想使用 PHP 查询或读取 Sharepoint 数据库.

I am not familiar with Sharepoint. I would like to query or read Sharepoint database using PHP.

有没有办法做到这一点?

Is there a way I can do that?

提前谢谢你.非常感谢任何帮助.

Thank you in advanc. Any help is greatly appreciated.

推荐答案

您应该考虑使用适用于 SharePoint 的 Camelot PHP 工具,它是专为 SharePoint 列表构建的 Camelot XML 格式的一个有据可查的 php 框架.

You should consider using the Camelot PHP Tools for SharePoint, it's a well documented php framework for the Camelot XML format specially constructed for SharePoint lists.

文档和下载

  • http://docs.bendsoft.com/camelot-php-tools/
  • http://www.bendsoft.com/downloads/sharepoint-php-tools/

您还需要 Camelot SharePoint 集成工具包、http://camelottoolkit.codeplex.com/ 和 Camelot .NET 连接器(http://www.bendsoft.com/net-sharepoint-connector/).

You will also need the Camelot SharePoint Integration Toolkit, http://camelottoolkit.codeplex.com/ and the Camelot .NET Connector (http://www.bendsoft.com/net-sharepoint-connector/).

在可以访问 SharePoint 服务器的盒子上安装连接器,这可能是与 SharePoint 服务器相同的服务器,然后在与连接器相同的服务器上安装集成工具包.设置集成工具包中包含的集成服务(按照说明操作),然后就完成了.网站上还有一些说明视频.

Install the Connector on a box that can reach the SharePoint server, this may be the same server as the SharePoint server, then install the Integration Toolkit on the same server as the Connector. Set up the integration service that is included in the integration toolkit (follow the instructions) and then you are done. There are a few instruction videos on the websites as well.

使用它的好处是您将能够使用常见的 SQL 查询通过 API 与 SharePoint 列表和库进行对话,从不使用基础 mssql 数据库.

The upsides of using this is that you will be able to talk to SharePoint lists and libraries through the API by using common SQL queries, the underlying mssql database is never used.

使用 SQL 从 SharePoint 中选择数据

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

按列表和视图名称从 SharePoint 中选择数据

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

使用 SQL 和 SharePointNonQuery 在 SharePoint 中插入数据

$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'
));

还有一些存储过程可以帮助您进行一些操作,例如文档库的高级处理

There are also stored procedures to help you with some operations, like advanced handling of document libraries

下载文件

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

$download->download_file();

上传文件

$args = array(  
    "file" => $_FILES,
    "listName" => 'Shared Documents',
    "folder" => 'Folder/',
    "connection_name" => 'SharePointConnection2'
); 

$UploadFile = new CamelotUploadFile($args);

相关文章