microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.
Other
568 stars 144 forks source link

Class error when trying to add Temporary Access Method to User #1441

Closed Teejer closed 8 months ago

Teejer commented 8 months ago

I'm trying to create a Temporary Access Pass Authentication Method using the api in php, but I'm getting this error "Uncaught Error: Class "TemporaryAccessPassAuthenticationMethod" not found in ...". I've tried adding

use Microsoft\Graph\Generated\Model\TemporaryAccessPassAuthenticationMethod;

but that didn't make a difference. What am I missing? Other functions are working. It seems like maybe something is missing from the documentation maybe? Or is this a bug? I've got the same issue with adding phone methods.

function addAzureTempAccessPassGraph($username){

    try{
        $graphServiceClient = getAzureGraphServiceClient();

        $requestBody = new TemporaryAccessPassAuthenticationMethod();//error here
        $requestBody->setLifetimeInMinutes(480);
        $requestBody->setIsUsableOnce(false);

        $result = $graphServiceClient->users()->byUserId($username)->authentication()->temporaryAccessPassMethods()->post($requestBody)->wait();

        return $result;

    } catch (Exception $e){

            return $e;

    }

}
Teejer commented 8 months ago

crap looks like I missed a letter. use Microsoft\Graph\Generated\Models\TemporaryAccessPassAuthenticationMethod;

dang plural words.