| Author |  | 
      
        | turtles2 Newbie
 
  
 
 Joined: 18 January 2016
 Location: United States
 Online Status: Offline
 Posts: 2
 | 
          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
           | Posted: 18 January 2016 at 9:04am | IP Logged |   |  
           | 
 |  
 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
 | 
          Solved Your Documentation is outdated.
           | Posted: 18 January 2016 at 9:35am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | smalldeath Newbie
 
  
  
 Joined: 02 April 2016
 Location: Mexico
 Online Status: Offline
 Posts: 3
 | 
          how you solved this? I have the same problem.
           | Posted: 05 April 2016 at 5:34pm | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6167
 | 
          In current API version, the method is called getFolderInformation, and the documentation is currently up-to-date in this regard, please see this page.
           | Posted: 06 April 2016 at 3:32am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |