Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get File Properties #347

Open
wayzz1992 opened this issue Jul 24, 2024 · 0 comments
Open

Get File Properties #347

wayzz1992 opened this issue Jul 24, 2024 · 0 comments
Labels

Comments

@wayzz1992
Copy link

wayzz1992 commented Jul 24, 2024

Hi

I am new to using phpSPO and am trying to get the list of properties of my files. I have followed the examples and some threads and this is the code I am using :

        $files = $this->ctx->getWeb()->getFolderByServerRelativeUrl($listTitle)->getFiles()->expand("ListItemAllFields");
        $this->ctx->load($files);
        $this->ctx->executeQuery();
        
        foreach ($files->getData() as $file) {
            $properties = $file->getListItemAllFields();
            error_log(json_encode($properties));

            error_log("name: '{$file->getProperty("Title")}'") ;
            error_log("name: '{$file->getProperty("ServerRelativeUrl")}'") ;
        }

The code returns a list of files and I can access some of the properties but I also want to get the Author and some custom columns.

When using $properties->{$propname} code returns an empty string.

@vgrem vgrem added the question label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants