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

Fix Empty Child Folder Error #474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bierpub
Copy link
Contributor

@bierpub bierpub commented Feb 8, 2024

I have multiple Outlook 365 accounts that are receiving the failed to fetch any folders exception. The problem is happening on the Contacts and Conversation History folders. These have the HasChildren flag set but there are no child folders. Contacts is not a message folder and I suspect is related to the contact address book. Conversation History can store messages and have subfolders, but there are none right now. It seems incorrect that HasChildren is set, but this ends up causing an exception to be thrown when looking for those subfolders even though many primary folders were successfully found.

This can be fixed by setting $soft_fail to true only when checking the child folders. If no child folders are found it can continue on normally and return all of the folders that were found. This will still throw the normal exception if the primary folders were not found.

This resolves Issue #453

image

@Webklex
Copy link
Owner

Webklex commented Apr 11, 2024

Hi @bierpub ,
many thanks for your pull request and suggested improvements. However I have a question before merging your pull request. You've replaced $soft_fail with true - why not simply set the $soft_fail method argument to archive the same? Perhaps I'm missing something :)

Best regards & happy coding,

@bierpub
Copy link
Contributor Author

bierpub commented Apr 11, 2024

Hi @bierpub , many thanks for your pull request and suggested improvements. However I have a question before merging your pull request. You've replaced $soft_fail with true - why not simply set the $soft_fail method argument to archive the same? Perhaps I'm missing something :)

Best regards & happy coding,

Hi @Webklex,
Are you suggesting to do this? It would have the same outcome.

$soft_fail = true;
$children = $this->getFolders(true, $pattern, $soft_fail);

Or are you wondering why I don't set it to true when first calling getFolders? The reason is that it seems valid to throw an exception if the top level folders are all missing. This suggested change preserves that functionality. What I am trying to prevent is throwing an exception if one of those folders does not have child folders. We might find multiple top level folders, meaning it should not throw an exception. But if the error gets thrown when checking for child folders, it is incorrect to say it failed to fetch any folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants