79255517

Date: 2024-12-05 16:39:50
Score: 1
Natty:
Report link

I hate to answer my own question, but the reason was the initial connection.

After changing the url from 'https://.sharepoint.com' to 'https://.sharepoint.com/sites/office', I was able to display the files.

$siteUrl = "https://<subdomain>.sharepoint.com/sites/office";
$credentials = new ClientCredential($settings['ClientId'], $settings['ClientSecret']);
$ctx = (new ClientContext($siteUrl))->withCredentials($credentials);

I hope this answer helps others

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user18797383