-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#103 : fix for properly encode whitespaces once list & view is refere…
…nced by title
- Loading branch information
Showing
24 changed files
with
262 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
|
||
use Office365\PHP\Client\GraphClient\GraphServiceClient; | ||
use Office365\PHP\Client\Runtime\Auth\AuthenticationContext; | ||
use Office365\PHP\Client\Runtime\Auth\OAuthTokenProvider; | ||
use Office365\PHP\Client\Runtime\Utilities\UserCredentials; | ||
|
||
require_once '../bootstrap.php'; | ||
|
||
try | ||
{ | ||
$client = getAuthenticatedClient(); | ||
//downloadPhoto($client,"./myprofile.jpg"); | ||
getDriveInfo($client); | ||
|
||
} | ||
catch (Exception $e) { | ||
echo 'Error: ', $e->getMessage(), "\n"; | ||
} | ||
|
||
|
||
function getDriveInfo(GraphServiceClient $client){ | ||
$drive = $client->getMe()->getDrive(); | ||
$client->load($drive); | ||
$client->executeQuery(); | ||
print $drive->getProperty("webUrl"); | ||
} | ||
|
||
|
||
function downloadPhoto(GraphServiceClient $client,$targetFilePath){ | ||
$fp = fopen($targetFilePath, 'w+'); | ||
//$url = $client->getServiceRootUrl() . "me/photo\$value"; | ||
$url = $client->getServiceRootUrl() . "me/photo"; | ||
$options = new \Office365\PHP\Client\Runtime\Utilities\RequestOptions($url); | ||
//$options->StreamHandle = $fp; | ||
$content = $client->executeQueryDirect($options); | ||
fclose($fp); | ||
} | ||
|
||
|
||
function getAuthenticatedClient(){ | ||
global $AppSettings; | ||
global $Settings; | ||
$resource = "https://graph.microsoft.com"; | ||
$authorityUrl = OAuthTokenProvider::$AuthorityUrl . $AppSettings['TenantName']; | ||
$authCtx = new AuthenticationContext($authorityUrl); | ||
$authCtx->acquireTokenForUserCredential($resource,$AppSettings['ClientId'],new UserCredentials($Settings['UserName'],$Settings['Password'])); | ||
$client = new GraphServiceClient($authCtx); | ||
return $client; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Office365\PHP\Client\GraphClient; | ||
|
||
use Office365\PHP\Client\OneDrive\CurrentUserRequestContext; | ||
use Office365\PHP\Client\Runtime\Auth\IAuthenticationContext; | ||
use Office365\PHP\Client\Runtime\ClientAction; | ||
use Office365\PHP\Client\Runtime\ClientRuntimeContext; | ||
use Office365\PHP\Client\Runtime\OData\JsonFormat; | ||
use Office365\PHP\Client\Runtime\OData\ODataMetadataLevel; | ||
use Office365\PHP\Client\Runtime\Office365Version; | ||
use Office365\PHP\Client\Runtime\ResourcePathEntity; | ||
use Office365\PHP\Client\Runtime\Utilities\RequestOptions; | ||
|
||
class GraphServiceClient extends ClientRuntimeContext | ||
{ | ||
public function __construct(IAuthenticationContext $authContext) | ||
{ | ||
$serviceRootUrl = "https://graph.microsoft.com/" . Office365Version::V1 . "/"; | ||
parent::__construct($serviceRootUrl, $authContext,new JsonFormat(ODataMetadataLevel::Verbose)); | ||
} | ||
|
||
|
||
public function executeQuery() | ||
{ | ||
$this->getPendingRequest()->beforeExecuteQuery(function (RequestOptions $request,ClientAction $query){ | ||
}); | ||
parent::executeQuery(); | ||
} | ||
|
||
/** | ||
* @return CurrentUserRequestContext | ||
*/ | ||
public function getMe(){ | ||
if(!isset($this->me)) | ||
$this->me = new CurrentUserRequestContext($this,new ResourcePathEntity($this,null,"me")); | ||
return $this->me; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.