Garethp / php-ews

PHP Exchange Web Services
BSD 3-Clause "New" or "Revised" License
112 stars 45 forks source link

Delete a folder #126

Open r-hede opened 6 years ago

r-hede commented 6 years ago

Hi,

I am trying to delete a folder with the following code:

use garethp\ews\API\Enumeration\DistinguishedFolderIdNameType;

$api = MailAPI::withUsernameAndPassword($host, $login, $password);

$folders = $api->getChildrenFolders(DistinguishedFolderIdNameType::MESSAGE_ROOT);

$api->deleteFolder($folders[$folderId]->getFolderId());

It seems simple but it doesn't work.

Of course, the folderId variable is the location of the folder that I created and that I want to delete.

Could you help me?

Thank you.

Garethp commented 6 years ago

What's the error that you're getting?

r-hede commented 6 years ago

Just a simple error 500, no error message is displayed.

Garethp commented 6 years ago

There should almost definitely be an exception of some kind. What about a stack trace?

r-hede commented 6 years ago

Effectively, I activated PHP errors and I get this:

Fatal error:  Uncaught Error: Call to undefined function garethp\ews\garethp\ews\Utilities\getFolderIds() in C:\Apache24\htdocs\new-app-v4\app\library\garethp\php-ews\src\API.php:227
Stack trace:
#0 C:\Apache24\htdocs\new-app-v4\app\library\garethp\php-ews\src\API.php(222): garethp\ews\API->deleteFolders(Object(garethp\ews\API\Type\FolderIdType), Array)
#1 C:\Apache24\htdocs\new-app-v4\app\controllers\MailBoxController.php(66): garethp\ews\API->deleteFolder(Object(garethp\ews\API\Type\FolderIdType))
#2 [internal function]: MailBoxController->indexAction()
#3 [internal function]: Phalcon\Dispatcher->callActionMethod(Object(MailBoxController), 'indexAction', Array)
#4 [internal function]: Phalcon\Dispatcher->dispatch()
#5 C:\Apache24\htdocs\new-app-v4\public\index.php(36): Phalcon\Mvc\Application->handle()
#6 {main}
  thrown in C:\Apache24\htdocs\new-app-v4\app\library\garethp\php-ews\src\API.php on line 227

However the function getFolderIds is correctly defined.

I specify that I use the latest version (0.9.6 - TBD).