phpSPO icon indicating copy to clipboard operation
phpSPO copied to clipboard

FilesCollection is returning Field objects instead of File objects in example code

Open markjwill opened this issue 4 years ago • 0 comments

https://github.com/vgrem/phpSPO/blob/master/examples/SharePoint/Folders/ReadFiles.php

PHP Fatal error: Uncaught TypeError: Argument 1 passed to {closure}() must be an instance of Office365\SharePoint\File, instance of Office365\SharePoint\Field given, called in /home/phpSPO/examples/SharePoint/Folders/ReadFiles.php on line 21 and defined in /home/phpSPO/examples/SharePoint/Folders/ReadFiles.php:33 Stack trace: #0 /home/phpSPO/examples/SharePoint/Folders/ReadFiles.php(28): {closure}(Object(Office365\SharePoint\Field), 0) #1 /home/phpSPO/examples/SharePoint/Folders/ReadFiles.php(42): forEachFile(Object(Office365\SharePoint\Folder), true, Object(Closure)) #2 {main} thrown in /home/phpSPO/examples/SharePoint/Folders/ReadFiles.php on line 33

I am trying to get this example running in order to target a folder. My end goal is to upload to a folder, 3 levels deep in Sharepoint. Thus far I can upload to a root folder in Sharepoint, but anytime I try to target a folder in a folder I get nowhere.

markjwill avatar May 18 '21 21:05 markjwill