Extracting attachments from all emails in an Outlook folder

I have no experience at all with AppleScript but I’m wondering if there is a way to do this…

I want to extract all the attachments from every email contained in a folder in Outlook, and save them to a folder on my Mac. The PowerShell script below works on my work PC and does exactly what I want. When it runs, Outlook asks me to select a folder and then the attachments from every email in that folder are saved to a folder called Attachments on my Windows desktop. But is this possible on my Mac?

Add-Type -assembly "Microsoft.Office.Interop.Outlook"

$Outlook = New-Object -ComObject Outlook.Application

foreach ($message in $Outlook.GetNameSpace("MAPI").pickfolder().Items) 
{
   write-host $message.Subject

   foreach ($att in $message.Attachments)
   {
       write-host "Attachment: " $att.filename
       $att.saveasfile( (Join-Path "C:\Users\adrian.clark\Desktop\Attachments\" $att.FileName ))
   }
   
}

Not sure if this will help with historic files, but If you are using Microsoft 365 I think that there is some functionality built in using Microsoft Power Automate (it was called Flow) that will allow attachments to be automatically saved into OneDrive (or elsewhere) as they arrive.

and