Skip to content

User Requests

PrasadChinwal edited this page Dec 10, 2024 · 3 revisions
use PrasadChinwal\MicrosoftGraph\Facades\MicrosoftGraph;

$graph = MicrosoftGraph::users()->get();
dd($graph);
Response
Illuminate\Support\Collection {#668 ▼ // routes/graph.php:13
#items: array:100 [▼
 0 => PrasadChinwal\MicrosoftGraph\Response\User\User {#663 ▼
   #_additional: []
   #_dataContext: null
   +businessPhones: []
   +displayName: "XXXXXXX"
   +givenName: null
   +jobTitle: null
   +mail: null
   +mobilePhone: null
   +officeLocation: null
   +preferredLanguage: null
   +surname: null
   +userPrincipalName: "XXXXXX"
   +id: "XXXXXXXX"
 }
  • Get user from ID: Documentation Retrieves a user from principalName.
$graph = MicrosoftGraph::users()->find('abc@user.com');
dd($graph);
Response
PrasadChinwal\MicrosoftGraph\Response\User\User {#644 ▼ // routes/graph.php:17
#_additional: []
#_dataContext: null
+businessPhones: array:1 [▶]
+displayName: "XXXX"
+givenName: "XXXXX"
+jobTitle: "XXXXX"
+mail: "XXXX@XX.XXX"
+mobilePhone: null
+officeLocation: null
+preferredLanguage: null
+surname: "Chinwal"
+userPrincipalName: "XX@XXX.XXX.XXX"
+id: "1xXXXXXaaaXXX"
}
use PrasadChinwal\MicrosoftGraph\Builder\User\User;

$user = new User();
$user->usageLocation = 'US';
$response = MicrosoftGraph::users()->update('XXXXX@XXXX.XXX.XXXX', $user);

dd($response);

Returns true or false.

Clone this wiki locally