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() ) );