From e7f3ffa8dba503989461443ab4ef8fb2ca05f874 Mon Sep 17 00:00:00 2001 From: Garethp Date: Mon, 28 Sep 2015 14:46:00 +0200 Subject: [PATCH] Fixed a small possible bug --- CHANGELOG.md | 3 +++ src/API.php | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0b742a..1594321f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.5.7 - 2015-09-28 + * Allows the parentFolder in getFolderByDisplayName to be a folderId or a string + ## 0.5.6 - 2015-09-28 * Added simple support for creating folders * Added simple support for moving items diff --git a/src/API.php b/src/API.php index 7ad6902c..82d0731e 100644 --- a/src/API.php +++ b/src/API.php @@ -328,19 +328,23 @@ public function getFolderByFolderId($folderId) /** * @param $folderName - * @param string $parentFolder + * @param string|Type\FolderIdType $parentFolderId * @param array $options * @return bool|Type\BaseFolderType */ - public function getFolderByDisplayName($folderName, $parentFolder = 'root', $options = array()) + public function getFolderByDisplayName($folderName, $parentFolderId = 'root', $options = array()) { + if (is_string($parentFolderId)) { + $parentFolderId = $this->getFolderByDistinguishedId($parentFolderId)->getFolderId(); + } + $request = array( 'Traversal' => 'Shallow', 'FolderShape' => array( 'BaseShape' => 'AllProperties' ), 'ParentFolderIds' => array( - 'DistinguishedFolderId' => array('Id'=>$parentFolder) + 'FolderId' => $parentFolderId->toArray() ) );