I am trying to use PowerShell to get the currently selected folder in Outlook 2010. I am able to do this with vbscript.
Below is the PowerShell code that is NOT working.
$objOutlook = New-Object -com "Outlook.Application" $objNameSpace = $objOutlook.GetNameSpace("MAPI") objCurrentFolder = $GetOutlook.ActiveExplorer.CurrentFolder Write-Host $objCurrentFolder
Below is the vbscript code that is working.
Dim objOutlook, objNamespace, objCurrFolder Set objOutlook = CreateObject("Outlook.Application") Set objNamespace = objOutlook.GetNamespace("MAPI") Set objCurrFolder = objOutlook.ActiveExplorer.CurrentFolder WScript.Echo objCurrFolder
If I have the Inbox folder selected and I run both scripts, only the vbscript will return "Inbox". The PowerShell script will return a NULL value. It will work for other folders as well. The goal of this is to detect if a user has a SharePoint List folder selected, and change the selected folder to something else. As well as being able to confirm the selected folder was changed. I have a working/complete (but crude) vbscript that will perform all the tasks I want, but I would like to do this in PowerShell.
Any help or assistance would be much appreciated.
Kevin
Kevin Elwell