microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Class error when trying to add Temporary Access Method to User

Teejer opened this issue · comments

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;
        
    }
    
    
}

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

dang plural words.