microsoftgraph/msgraph-sdk-php

V2.4: getMessages and getChildFolders are empty

Pixolantis opened this issue · 2 comments

If I have a folder and want to read the subfolders or messages from it, the output is always empty. But if I count the contents, I get an output:

        $mailFolderId = 'AA......=';
        $mailFolders = $graphServiceClient->users()->byUserId($userId)->mailFolders()->byMailFolderId($mailFolderId)->get()->wait();
        $checkFolderId = $mailFolders->getId(); // Result: Correct Id
        echo 'Count child folder: '.$mailFolders->getChildFolderCount().'<br>'; // Result: 4
        echo 'Count total items: '.$mailFolders->getTotalItemCount().'<br>'; // Result: 10
        //$childFolders = $mailFolders->getChildFolders(); // Result: null
        //$childFolders = $mailFolders->getMessages(); // Result: null

If I make a query for subfolders and messages with the folderId, it works and I also get the corresponding values:

        $subMailFolders = $graphServiceClient->users()->byUserId($userId)->mailFolders()->byMailFolderId($mailFolderId)->childFolders()->get()->wait();
        $messages = $graphServiceClient->users()->byUserId($userId)->mailFolders()->byMailFolderId($mailFolderId)->messages()->get()->wait();

Is this a bug or am I missing something?

Edit: The same with getAttachments()

Thank you. This is ok.

I was just a little confused by the two functions and therefore expected a corresponding output.