SharepointXLStoXLSX/GraphConfig.ps1
2025-02-21 15:34:46 -08:00

32 lines
838 B
PowerShell

# App registration details
$script:graphConfig = @{
ClientId = "YOUR_CLIENT_ID" # Replace with your app registration client ID
TenantId = "YOUR_TENANT_ID" # Replace with your tenant ID
Scopes = @(
"Files.ReadWrite.All"
"Sites.ReadWrite.All"
"Sites.Read.All"
"Sites.Selected"
)
}
function Connect-Graph {
try {
Connect-MgGraph -ClientId $graphConfig.ClientId `
-TenantId $graphConfig.TenantId `
-Scopes $graphConfig.Scopes `
-UseDeviceCode
# Verify connection
$profile = Get-MgProfile
if ($profile) {
return $true
}
return $false
}
catch {
$script:txtStatus.Text += "Graph Connection Error: $($_.Exception.Message)`n"
return $false
}
}