PHP SharePoint Lists API 技术文档
1. 安装指南
使用 Composer 安装
如果你使用 Composer,只需将 thybag/php-sharepoint-lists-api
添加到你的 composer.json
文件中,然后运行 composer install
。
{
"require": {
"thybag/php-sharepoint-lists-api": "dev-master"
}
}
手动安装
如果你不使用 Composer,可以手动下载 SharePointAPI 文件,并在你的项目中包含顶层的 SharePointAPI.php
类。
2. 项目的使用说明
创建 SharePointAPI 对象
在使用 PHP SharePoint Lists API 之前,你需要一个具有所需列表权限的有效用户/服务账户。
对于大多数 SharePoint 安装,你可以使用以下方式创建 API 实例:
use Thybag\SharePointAPI;
$sp = new SharePointAPI('<username>', '<password>', '<path_to_WSDL>');
如果你的安装需要 NTLM 认证,可以使用以下方式:
use Thybag\SharePointAPI;
$sp = new SharePointAPI('<username>', '<password>', '<path_to_WSDL>', 'NTLM');
SharePoint Online 用户必须使用以下方式:
use Thybag\SharePointAPI;
$sp = new SharePointAPI('<username>', '<password>', '<path_to_WSDL>', 'SPONLINE');
所有方法默认返回数组。可以使用 SetReturnType
指定结果应作为对象返回。
3. 项目API使用文档
读取列表数据
返回列表中的所有项目
$sp->read('<list_name>');
或
$sp->query('<list_name>')->get();
返回列表中的前10项
$sp->read('<list_name>', 10);
或
$sp->query('<list_name>')->limit(10)->get();
返回姓氏为 "smith" 的所有项目
$sp->read('<list_name>', NULL, array('surname'=>'smith'));
或
$sp->query('<list_name>')->where('surname', '=', 'smith')->get();
返回姓氏为 "smith" 且年龄为 40 的前5项
$sp->read('<list_name>', 5, array('surname'=>'smith','age'=>40));
或
$sp->query('<list_name>')->where('surname', '=', 'smith')->and_where('age', '=', '40')->limit(5)->get();
使用特定视图返回姓氏为 "smith" 的前10项
$sp->read('<list_name>', 10, array('surname'=>'smith','age'=>40),'{0FAKE-GUID001-1001001-10001}');
或
$sp->query('<list_name>')->where('surname', '=', 'smith')->and_where('age', '=', '40')->limit(10)->using('{0FAKE-GUID001-1001001-10001}')->get();
返回姓氏为 "smith" 且按年龄排序的前10项
$sp->read('<list_name>', 10, array('surname'=>'smith'), NULL, array('age' => 'desc'));
或
$sp->query('<list_name>')->where('surname', '=', 'smith')->limit(10)->sort('age','DESC')->get();
返回前5项,包括 "favroite_cake" 和 "favorite_animal" 列
$sp->read('<list_name>', 5, NULL, array("favroite_cake", "favorite_animal"));
或
$sp->query('<list_name>')->fields(array("favroite_cake", "favorite_animal"))->limit(5)->get();
查询列表
查询方法可以用于需要指定复杂查询的情况。查询是通过一系列(希望是表达性的)伪 SQL 方法构建的。
例如,如果你想查询一个宠物列表并返回所有年龄小于5岁的狗(按年龄排序),你可以使用:
$sp->query('list of pets')->where('type','=','dog')->and_where('age','<','5')->sort('age','ASC')->get();
如果你想获取前10个宠物,它们要么是猫要么是仓鼠,你可以使用:
$sp->query('list of pets')->where('type','=','cat')->or_where('type','=','hamster')->limit(10)->get();
添加到列表
要向列表中添加新项目,可以使用 write
、add
或 insert
方法(所有方法功能相同)。创建一个包含 forename、surname、age 和 phone 列的新记录可能如下所示:
$sp->write('<list_name>', array('forename'=>'Bob','surname' =>'Smith', 'age'=>40, 'phone'=>'(00000) 000000' ));
你还可以通过以下方式一起运行多个写操作:
$sp->writeMultiple('<list_name>', array(
array('forename' => 'James'),
array('forename' => 'Steve')
));
编辑行
要编辑一行,你需要其 ID。假设上面的行有 ID 5,我们可以将 Bob 的名字改为 James:
$sp->update('<list_name>','5', array('forename'=>'James'));
与 write
方法一样,你也可以通过以下方式一起运行多个更新操作:
$sp->updateMultiple('<list_name>', array(
array('ID'=>5,'job'=>'Intern'),
array('ID'=>6,'job'=>'Intern')
));
删除行
要删除一行,需要其 ID 和列表名称。要删除 ID 为 5 的 James 记录,你可以使用:
$sp->delete('<list_name>', '5');
如果你希望一次删除多个记录,也可以将 ID 数组传递给 deleteMultiple
方法:
$sp->deleteMultiple('<list_name>', array('6','7','8'));
4. 项目安装方式
使用 Composer 安装
{
"require": {
"thybag/php-sharepoint-lists-api": "dev-master"
}
}
手动安装
手动下载 SharePointAPI 文件,并在你的项目中包含顶层的 SharePointAPI.php
类。
HunyuanImage-3.0
HunyuanImage-3.0 统一多模态理解与生成,基于自回归框架,实现文本生成图像,性能媲美或超越领先闭源模型00ops-transformer
本项目是CANN提供的transformer类大模型算子库,实现网络在NPU上加速计算。C++045Hunyuan3D-Part
腾讯混元3D-Part00GitCode-文心大模型-智源研究院AI应用开发大赛
GitCode&文心大模型&智源研究院强强联合,发起的AI应用开发大赛;总奖池8W,单人最高可得价值3W奖励。快来参加吧~0288Hunyuan3D-Omni
腾讯混元3D-Omni:3D版ControlNet突破多模态控制,实现高精度3D资产生成00GOT-OCR-2.0-hf
阶跃星辰StepFun推出的GOT-OCR-2.0-hf是一款强大的多语言OCR开源模型,支持从普通文档到复杂场景的文字识别。它能精准处理表格、图表、数学公式、几何图形甚至乐谱等特殊内容,输出结果可通过第三方工具渲染成多种格式。模型支持1024×1024高分辨率输入,具备多页批量处理、动态分块识别和交互式区域选择等创新功能,用户可通过坐标或颜色指定识别区域。基于Apache 2.0协议开源,提供Hugging Face演示和完整代码,适用于学术研究到工业应用的广泛场景,为OCR领域带来突破性解决方案。00- HHowToCook程序员在家做饭方法指南。Programmer's guide about how to cook at home (Chinese only).Dockerfile09
- PpathwayPathway is an open framework for high-throughput and low-latency real-time data processing.Python00
热门内容推荐
最新内容推荐
项目优选









