phpSPO and authentication

Viewed 16

I need to access a file on SharePoint and I have installed phpSPO via Composer.

I use this code:

require_once('/vendor/autoload.php');

$username = 'myUsername';
$password = 'myPassword';
$fileUrl = "file-url";
$fileUrl = end(explode("https://xxxxxxxx.sharepoint.com", $fileUrl));

use Office365\PHP\Client\Runtime\Auth\AuthenticationContext;
use Office365\PHP\Client\SharePoint\ClientContext;
use Office365\PHP\Client\SharePoint\ListCreationInformation;
use Office365\PHP\Client\SharePoint\SPList;

$authCtx = new AuthenticationContext('https://xxxxxxxx.sharepoint.com');

But I get this error: Fatal error: Uncaught Error: Class "Office365\PHP\Client\Runtime\Auth\AuthenticationContext" not found ...

From composer.json:

{ 
    "require": { 
        "vgrem/php-spo": "^2.5" 
    } 
}

Any ideas?

Solution:

use Office365\Runtime\Auth\AuthenticationContext;
use Office365\SharePoint\ClientContext;
use Office365\SharePoint\ListCreationInformation;
use Office365\SharePoint\SPList;
0 Answers
Related