Hi @Gal, Ofer ,
Judging according to the error message, you did not import the MicrosoftGraph module in the code, please try to import the module in the code.
import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
If you are developing SPFX, you may have a look at the MSGraphClient.MSGraphClient is a new HTTP client introduced in SharePoint Framework v1.6.0 that simplifies connecting to the Microsoft Graph inside SharePoint Framework solutions.
Use the MSGraphClient to connect to Microsoft Graph
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.