Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: API Issue Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
turtles2
Newbie
Newbie


Joined: 18 January 2016
Location: United States
Online Status: Offline
Posts: 2
Posted: 18 January 2016 at 9:04am | IP Logged Quote turtles2

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 View turtles2's Profile Search for other posts by turtles2
 
turtles2
Newbie
Newbie


Joined: 18 January 2016
Location: United States
Online Status: Offline
Posts: 2
Posted: 18 January 2016 at 9:35am | IP Logged Quote turtles2

Solved Your Documentation is outdated.
Back to Top View turtles2's Profile Search for other posts by turtles2
 
smalldeath
Newbie
Newbie
Avatar

Joined: 02 April 2016
Location: Mexico
Online Status: Offline
Posts: 3
Posted: 05 April 2016 at 5:34pm | IP Logged Quote smalldeath

how you solved this? I have the same problem.
Back to Top View smalldeath's Profile Search for other posts by smalldeath
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 06 April 2016 at 3:32am | IP Logged Quote Igor

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 View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide