Outlook ActiveExplorer() - working vba to powershell

Hi Community,

I please just need to transpose a working vba code to powershell but I fail doing this.

Synopsys : Change Outlook active explorer folder with powershell.

I really need to interact with active explorer of active window because after creating a new contact adress book the window don’t refresh and don’t set the focus on the new adress book.


Example of Working VBA to adapt in powershell :

Sub ChangeCurrentFolder()
Dim myNamespace As Outlook.NameSpace
Set myNamespace = Application.GetNamespace(“MAPI”)
Set Application.ActiveExplorer.CurrentFolder = myNamespace.GetDefaultFolder(olFolderCalendar)
End Sub

Sorry, I think I found …

Working outlook powershell to refresh Contact folder :

$RefreshContactFolderName = “TEST” # Must be a real outlook contact folder

$Outlook = New-Object -ComObject Outlook.Application
$ContactFolder = $Outlook.Session.GetDefaultFolder(10).Folders.Item($RefreshContactFolderName)

$Outlook.ActiveExplorer().CurrentFolder = $ContactFolder