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
<?php | |
// v1.x | |
$response = $graphClient->createRequest('GET', '/users/userId/messages') | |
->setReturnType(Model\User::class) | |
->execute(); | |
// v2.0.0 | |
$response = $graphServiceClient->users()->byUserId('userId')->messages()->get()->wait(); |
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
<?php | |
// v1.x | |
$response = $graphClient->createRequest('GET', '/users/userId/messages') | |
->setReturnType(Model\User::class) | |
->execute(); | |
// v2.0-RC | |
$response = $graphServiceClient->usersById('userId')->messages()->get()->wait(); |
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
<?php | |
// v1.x | |
$accessToken = getAccessToken(); // custom token retrieval method | |
$graph = new Graph(); | |
$graph->setAccessToken($accessToken); | |
$graph ->createRequest('GET', '/me') | |
->setAccessToken(getAccessToken()) //after initial token expires | |
... |
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
<?php | |
//RC5 initialization experience | |
$tokenRequestContext = new ClientCredentialContext( | |
'tenantID', | |
'clientID', | |
'clientSecret' | |
); | |
$scopes = ['https://graph.microsoft.com/.default']; | |
$authProvider = new PhpLeagueAuthenticationProvider($tokenRequestContext, $scopes); |
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
<?php | |
//RC5 | |
$response = $graphServiceClient->usersById('userID')->get(); | |
//RC19 | |
$response = $graphServiceClient->users()->byUserId('userId')->get(); |
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
{ | |
"name": "isvargasmsft/phpdemoapp", | |
"description": "This is an app for demos", | |
"authors": [ | |
{ | |
"name": "y" | |
} | |
], | |
"minimum-stability": "RC", | |
"require": { |
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
<?php | |
use Microsoft\Graph\GraphServiceClient; | |
use Microsoft\Kiota\Abstractions\ApiException; | |
use Microsoft\Kiota\Authentication\Oauth\ClientCredentialContext; | |
set_include_path(__DIR__); | |
require 'vendor/autoload.php'; | |
$tokenRequestContext = new ClientCredentialContext( | |
'tenantID', |
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
import asyncio | |
from azure.identity.aio import ClientSecretCredential | |
from msgraph import GraphServiceClient | |
credential = ClientSecretCredential( | |
'tenant_id', | |
'client_id', | |
'client_secret' | |
) | |
scopes = ['https://graph.microsoft.com/.default'] |
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
# Example using async credentials and application access. | |
from azure.identity.aio import ClientSecretCredential | |
from msgraph import GraphServiceClient | |
credential = ClientSecretCredential( | |
'TENANT_ID', | |
'CLIENT_ID', | |
'CLIENT_SECRET', | |
) | |
scopes = ['https://graph.microsoft.com/.default'] |
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
client = GraphServiceClient(credentials=credential, scopes=scopes) | |
# GET /users/{id | userPrincipalName} | |
async def get_user(): | |
user = await client.users.by_user_id('userPrincipalName').get() |
OlderNewer