1. Go to this page and download the library: Download plokko/laravel-msgraph library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$userQuery = MsGraph::User()->list();
$userQuery
->search('displayName:Test')
;
$count = $userList->count(); // Execute the query
/**@var int $count**/
// Prepare your user data as a Microsoft\Graph\Model\User object or as an Array of key-values
$userData = new \Microsoft\Graph\Model\User([
"mailNickname" => 'UserName',
"displayName" => "User Name",
"givenName" => "User",
"surname" => "Name",
"password" => "TheUserPassword123",
"jobTitle" => null,
"mail" => "[email protected]",
"userPrincipalName" => "[email protected]",
"mobilePhone" => null,
"businessPhones" => ['0000 123456'],
"officeLocation" => null,
"preferredLanguage" => null,
]);
// Or
$userData = [
"mailNickname" => 'UserName',
"displayName" => "User Name",
"givenName" => "User",
"surname" => "Name",
"password" => "TheUserPassword123",
"jobTitle" => null,
"mail" => "[email protected]",
"userPrincipalName" => "[email protected]",
"mobilePhone" => null,
"businessPhones" => ['0000 123456'],
"officeLocation" => null,
"preferredLanguage" => null,
];
//...
$password = null; //If set will overwrite user password in data
$accountEnabled = null; // If the account is enabled, if set will overwrite user data, if null and not set in user data it will default to true
$forcePasswordChange = false; // Will force password change on next login (see passwordProfile)
MsGraph::User()->create($userData,$password,$accountEnabled,$forcePasswordChange);
// Prepare your user data as a Microsoft\Graph\Model\User object or as an Array of key-values
// id or userPrincipalName are -id',
"mailNickname" => 'UserName',
]);
// Or
$userData = [
"userPrincipalName" => "[email protected]",
"mailNickname" => 'UserName',
];
//...
MsGraph::User()->update($userData);