Author |
|
turtles2 Newbie
Joined: 18 January 2016 Location: United States
Online Status: Offline Posts: 2
|
Posted: 18 January 2016 at 9:04am | IP Logged
|
|
|
My am trying to get the number of unread emails with API i am getting this error Fatal error: Call to undefined method CApiMailManager::FolderCounts() in /Path to file
Here is my code
include_once __DIR__.'/webmail/libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid())
{
$sEmail = 'email@gmail.com';
$sPassword = 'password';
$sFolder = 'INBOX';
try
{
$oApiIntegratorManager = CApi::Manager('integrator');
$oAccount = $oApiIntegratorManager->LoginToAccount($sEmail, $sPassword);
if ($oAccount)
{
$oApiMailManager = CApi::Manager('mail');
$aData = $oApiMailManager->FolderCounts($oAccount, $sFolder);
echo '<b>'.$oAccount->Email.':</b><br />';
if (is_array($aData) && 4 === count($aData))
{
echo '<pre>';
echo 'Folder: '.$sFolder."\n";
echo 'Count: '.$aData[0]."\n";
echo 'Unread: '.$aData[1]."\n";
echo 'UidNext: '.$aData[2]."\n";
echo 'Hash: '.$aData[3];
echo '</pre>';
}
}
else
{
echo $oApiIntegratorManager->GetLastErrorMessage();
}
}
catch (Exception $oException)
{
echo $oException->getMessage();
}
}
else
{
echo 'WebMail API isn\'t available';
}
|
Back to Top |
|
|
turtles2 Newbie
Joined: 18 January 2016 Location: United States
Online Status: Offline Posts: 2
|
Posted: 18 January 2016 at 9:35am | IP Logged
|
|
|
Solved Your Documentation is outdated.
|
Back to Top |
|
|
smalldeath Newbie
Joined: 02 April 2016 Location: Mexico
Online Status: Offline Posts: 3
|
Posted: 05 April 2016 at 5:34pm | IP Logged
|
|
|
how you solved this? I have the same problem.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 06 April 2016 at 3:32am | IP Logged
|
|
|
In current API version, the method is called getFolderInformation, and the documentation is currently up-to-date in this regard, please see this page.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|