Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 564 Bytes

File metadata and controls

21 lines (16 loc) · 564 Bytes

List all applications in a tenant

// Create a new GraphServiceClient instance
$graphServiceClient = new GraphServiceClient($tokenRequestContext);

try {
    $applications = $graphServiceClient->applications()->get()->wait();
    if ($applications && $applications->getValue()) {
        foreach ($applications->getValue() as $app) {
            echo "Application ID: {$app->getId()}<br>";
        }
    }
} catch (ApiException $ex) {
    echo "Error: " . $ex->getResponseStatusCode() . "\n";
    echo "Error: " .$ex->getError()->getMessage();";
}