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_message on a empty folder #10

Open
jplfl opened this issue Oct 10, 2012 · 1 comment
Open

get_message on a empty folder #10

jplfl opened this issue Oct 10, 2012 · 1 comment

Comments

@jplfl
Copy link

jplfl commented Oct 10, 2012

Thank you for this very useful peace of code!

Changes on ExchangeClient.php

'204,206c204
'<
'< $items = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Message;
'<
'---.
'>
'210c208
'< if(count($items) == 0)
'---
'> if($response->ResponseMessages->FindItemResponseMessage->RootFolder->TotalItemsInView == 0)
'212a211,212
'> $items = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Message;
'>

@gregesposito
Copy link

Fantastic, this solved a problem I had. I made the following changes to ExchangeClient.php:

    if ($response->ResponseMessages->FindItemResponseMessage->RootFolder->TotalItemsInView != 0) {
        $items = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Message;
    } else {
        return false; //we didn't get anything back!
    }

And the following changes to my usual parser code:

    $messages = $ec->get_messages(50, false, "inbox");
    if (!empty($messages)) {
        foreach ($messages as $message) {...}

I no longer get Undefined property: stdClass::$Message and Invalid argument supplied for foreach() warnings in my logs. Thanks!

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

No branches or pull requests

2 participants