Trouble Accessing Items in folder path \\email@domain.com\Conversations\Target Folder

91520968 0 Reputation points
2023-04-07T20:35:57.7633333+00:00

I'm having a difficult time accessing a specific folder using a COM interface. The language I'm using is AutoHotkey (ahk for short is a scripting / automation language). However, I have the same issue when using Python, so this does not seem to be an implementation issue. I'm trying to access a folder for an e-mail group of which I am a member: QZespLr

The folder is called "AcraDyne MAC" I have no trouble targeting the folder by using ActiveExplorer.Selection.Item(1) (assuming I have an item within the folder selected in the active explorer window). ActiveExplorer.CurrentFolder.FolderPath returns "\\email@domain.com\Conversations\AcraDyne MAC"

However, using Session.Folders("email@domain.com").Folders("Conversations").Folders("Acradyne MAC").Items.Item(1).Subject for instance returns an object could not be found error. Further exploring shows that the "Conversations" folder does not exist in my folder tree. So my question is this: How can I access the folder in question without having to resort to the ActiveExplorer class? My goal here is to be able to iterate through the items in the folder to find one with a specific subject and grab the attachment. I do not want to have to force the user to Activate the outlook app and select the folder in question. for reference the relevant code is below:

ol := ComObjActive("Outlook.Application")
item := ol.ActiveExplorer.Selection.Item(1) ;this works as expected and I can access the mailitem as needed this way
msgbox, % clipboard := ol.ActiveExplorer.CurrentFolder.FolderPath
;clipboard now contains: "\\email@domain.com\Conversations\AcraDyne MAC"
ol.Session.Folders("email@domain.com").Folders("Conversations").Folders("Acradyne MAC").Items.Item(1).Subject 
;the above returns an error: the object could not be found
Outlook
Outlook
A family of Microsoft email and calendar products.
3,130 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,593 questions
{count} votes