From c6c07693849a09f2e3faf1c74147f5437aa62eb7 Mon Sep 17 00:00:00 2001 From: "Bobby Abellana (aider)" Date: Fri, 21 Feb 2025 10:56:30 -0800 Subject: [PATCH] fix: Use -OutputFilePath for binary downloads in Convert-Files --- SharePointFunctions.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SharePointFunctions.ps1 b/SharePointFunctions.ps1 index fd123a2..fe34831 100644 --- a/SharePointFunctions.ps1 +++ b/SharePointFunctions.ps1 @@ -457,8 +457,7 @@ function Convert-Files { $downloadUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:/$($encodedPath):/content" # Download the file - $fileContent = Invoke-MgGraphRequest -Uri $downloadUri -Method GET - [System.IO.File]::WriteAllBytes($downloadPath, $fileContent) + Invoke-MgGraphRequest -Uri $downloadUri -Method GET -OutputFilePath $downloadPath if (-not (Test-Path $downloadPath)) { throw "Failed to download file from SharePoint" }