Skip to content

Releases: vgrem/phpSPO

Version 3.1.2

21 Apr 18:49
Compare
Choose a tag to compare

Added

  • GraphServiceClient::withUserCredentials and GraphServiceClient::withClientSecret methods introduced

Fixed

  • #337: Don't try to retrieve next set of items when using an iterator, if no next items are expected to exist

Version 3.1.1

30 Sep 09:46
Compare
Choose a tag to compare

Changelog

  • SharePoint model updated to 16.0.24106.12014 version
  • import fixes (patches for 3.1.0 version)

Version 3.1.0

29 Sep 18:39
Compare
Choose a tag to compare

Changelog

  • support for authenticate SharePoint API via client certificate flow
  • validate access token response in GraphServiceClient

Example: how to authenticate SharePoint API via client certificate flow

$siteUrl = "https://contoso.sharepoint.com";  //site or web absolute url 
$tenant = "contoso.onmicrosoft.com"; //tenant id or name
$thumbprint = "--thumbprint goes here--";
$clientId = "--client app id goes here--";
$privateKetPath = "-- path to private.key file--"
$privateKey = file_get_contents($privateKetPath);

$ctx = (new ClientContext($siteUrl))->withClientCertificate(
    $tenant, $clientId, $privateKey, $thumbprint);

$whoami = $ctx->getWeb()->getCurrentUser()->get()->executeQuery();
print $whoami->getLoginName();

Version 3.0.3

15 Jul 16:48
Compare
Choose a tag to compare

Changelog

  • support for document sets in SharePoint API
  • fix addering issue with web resource

Example: create a Document Set

$credentials = new ClientCredential($clientId, $clientSecret);
$client = (new ClientContext($siteUrl))->withCredentials($credentials);

$docSetName = "Orders"; 
$lib = $client->getWeb()->defaultDocumentLibrary();
$docSet = DocumentSet::create($client, $lib->getRootFolder(), $docSetName)->executeQuery();
print($docSet->getProperty("ServerRelativeUrl"));

Version 3.0.2

15 Mar 20:16
Compare
Choose a tag to compare

Changelog

  • #325 PR: fix composer autoload issue by @menegain-mathieu

Version 3.0.1

21 Jan 20:43
Compare
Choose a tag to compare

Changelog

  • #300: add CcRecipients property to Message class by @DavidBrogli
  • #304: Http Response improvements by @lbuchs
  • #307 add example to obtain available fields of a list by @cweiske
  • #318 Support for custom curl options by @drml
  • ClientObjectCollection class enhancements, introduced getAll method by @vgrem

Example: read list items in a large list via getAll method:

$ctx = (new ClientContext($siteUrl))->withCredentials($credentials);
$list = $ctx->getWeb()->getLists()->getByTitle("--large list title--");

$allItems = $list->getItems()->getAll(5000, function ($returnType){
    print("{$returnType->getPageInfo()} items loaded...\n");
})->executeQuery();

Version 3.0.0

07 Oct 17:09
da94ab7
Compare
Choose a tag to compare

Changelog

  • #283: exception handling enhancements for authentication requests by @SuperDJ
  • #286: introduced client secret support for acquireTokenForPassword method in AADTokenProvider class by @R-TECH
  • #287 and #288: captures and validates if response failed by @fr3nch13
  • #297: remove minimum-stability from composer.json by @cweiske
  • #298 and #299: deprecation fixes for PHP 8 and drop PHP 5.5 requirement by @cweiske

Version 2.5.4

07 Jul 10:29
Compare
Choose a tag to compare

Changelog

Version 2.5.3

05 Feb 18:16
Compare
Choose a tag to compare

Changelog

  • SharePoint API: improved support for composite field values namely FieldLookupValue/FieldMultiLookupValue, FieldMultiChoiceValue , refer example 1 below ( related issues: #261)
  • OData request/response serialization optimizations (namely excluding metadata annotations from response by default)

Example : create list item and specify multi lookup & choice fields values:

$list = $ctx->getWeb()->getLists()->getByTitle("Tasks");

$taskProps = array(
    'Title' => "New task",
    'ParentTask' => new FieldLookupValue($taskLookupId),
    'PrimaryManager' => new FieldUserValue($userId),
    'Managers' => new FieldMultiLookupValue([$userId]),
    'TaskCategories' => new FieldMultiChoiceValue(["Event", "Reminder"])
);
$item = $list->addItem($taskProps)->executeQuery();

Version 2.5.2

09 Oct 10:58
Compare
Choose a tag to compare

Changelog

  • introduced Reports namespace, refer official documentation for a more details
  • Outlook namespace model updates
  • SharePoint API: model updated to 16.0.21729.12001 version

Example: Get details about Microsoft 365 active users

Documentation: reportRoot: getOffice365ActiveUserDetail

use Office365\GraphServiceClient;
use Office365\Runtime\Auth\AADTokenProvider;
use Office365\Runtime\Auth\ClientCredential;


function acquireToken()
{
   $resource = "https://graph.microsoft.com";
   $provider = new AADTokenProvider($tenantName);
   return $provider->acquireTokenForClientCredential($resource,
       new ClientCredential($clientId, $clientSecret),["/.default"]);
}

$client = new GraphServiceClient("acquireToken");
$result = $client->getReports()->getOffice365ActivationCounts()->executeQuery();
var_dump($result->getValue());

$result = $client->getReports()->getOffice365ActiveUserDetail("D7")->executeQuery();
var_dump($result->getValue());