From a2c22858a01836610d6f61696017d869415a22a0 Mon Sep 17 00:00:00 2001 From: romisfrag Date: Fri, 5 Jan 2024 14:55:11 +0100 Subject: [PATCH] Update GraphRunner.ps1 Fixed the issue in Invoke-SearchMailbox when trying to download files --- GraphRunner.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GraphRunner.ps1 b/GraphRunner.ps1 index 0d2fff7..4493203 100644 --- a/GraphRunner.ps1 +++ b/GraphRunner.ps1 @@ -4663,8 +4663,7 @@ Function Invoke-SearchMailbox{ New-Item -Path $folderName -ItemType Directory | Out-Null # Process the response and export email content foreach ($hit in $response.value[0].hitsContainers[0].hits) { - $webLink = $hit.resource.webLink - $itemId = [regex]::Match($webLink, "ItemID=([^&]+)").Groups[1].Value + $itemId = $hit.hitId $subject = $hit.resource.subject # Remove special characters and replace spaces with underscores