Skip to content

Commit

Permalink
MSFTMPP-156: Fixed error accessing sharepoint files
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcq committed Apr 21, 2015
1 parent b3f4e60 commit 1a69a21
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions repository/office365/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ protected function get_listing_course($path = '') {
try {
$fullpath = (!empty($relpath)) ? '/'.$relpath : '/';
$contents = $sharepointclient->get_files($fullpath);
$list = $this->contents_api_response_to_list($contents, $path, 'sharepoint');
$list = $this->contents_api_response_to_list($contents, $path, 'sharepoint', $parentsiteuri);
} catch (\Exception $e) {
$list = [];
}
Expand Down Expand Up @@ -420,10 +420,12 @@ protected function get_listing_my($path = '') {
* Transform a onedrive API response for a folder into a list parameter that the respository class can understand.
*
* @param string $response The response from the API.
* @param string $path The list path.
* @param string $clienttype The type of client that the response is from. onedrive/sharepoint.
* @param string $spparentsiteuri If using the Sharepoint clienttype, this is the parent site URI.
* @return array A $list array to be used by the respository class in get_listing.
*/
protected function contents_api_response_to_list($response, $path, $clienttype) {
protected function contents_api_response_to_list($response, $path, $clienttype, $spparentsiteuri = null) {
global $OUTPUT, $DB;
$list = [];
if ($clienttype === 'onedrive') {
Expand Down Expand Up @@ -459,7 +461,7 @@ protected function contents_api_response_to_list($response, $path, $clienttype)
'source' => $clienttype,
];
if ($clienttype === 'sharepoint') {
$source['parentsiteuri'] = $parentsiteuri;
$source['parentsiteuri'] = $spparentsiteuri;
}

$author = '';
Expand Down

0 comments on commit 1a69a21

Please sign in to comment.