【发布时间】:2019-08-19 18:47:04
【问题描述】:
我对 SharePoint 一点也不熟悉,我正在尝试构建一个 php 脚本来浏览和访问与我们共享的文件夹中的文件,如下所示:https://blabla.sharepoint.com/:b:/r/sites/SubSiteName/Shared%20Documents/OurCompanyName/Invoice
我找到了这些库:https://github.com/vgrem/phpSPO 和 https://github.com/thybag/PHP-SharePoint-Lists-API,但我找不到访问这些文件的好方法。 我还在这里找到了有关 php 和 SharePoint 的帖子,但似乎没有一个符合我的需要。
我已经用 phpSPO 尝试过这段代码,但它在 executeQuery() 处失败:
$authCtx = new AuthenticationContext('https://blabla.sharepoint.com');
$authCtx->acquireTokenForUser('our@email','password');
$ctx = new ClientContext('https://blabla.sharepoint.com',$authCtx);
$fileUrl = '/sites/SubSiteName/Shared Documents/OurCompanyName/Invoice/INV_123.PDF';
$file = $ctx->getWeb()->getFileByServerRelativeUrl($fileUrl);
$ctx->load($file);
$ctx->executeQuery();
print "File name: '{$file->getProperty("Name")}'\r\n";
【问题讨论】:
标签: php sharepoint