Vakari Posted September 9, 2008 Share Posted September 9, 2008 (edited) I've been using a script to scan through my e-mails and do various things. I'm trying to automate folder selection, as the folder never changes. This is the code I currently use to select it: $Outlook = ObjGet("", "Outlook.Application") If Not IsObj($Outlook) Then $Outlook = ObjCreate("Outlook.Application") $NameSpace = $Outlook.Session $Folder = $NameSpace.PickFolder ConsoleWrite($Folder.Name & @CR) Since the folder never changes, I want to hardcode it so I don't have to select the folder every time I run the program. The other alternative I've found is this: I modify the code above to: $Outlook = ObjGet("", "Outlook.Application") If Not IsObj($Outlook) Then $Outlook = ObjCreate("Outlook.Application") $NameSpace = $Outlook.Session $Folder = $NameSpace.PickFolder ConsoleWrite($Folder.EntryID & @CR) ConsoleWrite($Folder.StoreID & @CR) This will give me and EntryID that looks like: 00000010008618103808018310080 and a StoreID that looks like: 000000000000712729701720971279177107101000100011802870370200272000722200 Now I can make a third modification to the code: $EntryID = "00000010008618103808018310080" $StoreID = "000000000000712729701720971279177107101000100011802870370200272000722200" $Outlook = ObjGet("", "Outlook.Application") If Not IsObj($Outlook) Then $Outlook = ObjCreate("Outlook.Application") $NameSpace = $Outlook.Session $Folder = $NameSpace.GetFolderFromID($EntryID, $StoreID) Now it selects the folder automatically, but only after I ran the second bit of code and found the EntryID and StateID manually. I don't know enough about EntryID and StoreID, and am curious to know if they can change randomly, or create some other unknown issue. I'm aware of methods to automatically select your Inbox, or other default folders via $NameSpace.GetDefaultFolder, but how do you go about automatically selecting folders that are in an archive you created or in another mailbox? $Folder.FolderPath in any of the scripts above will return "\\Archive\Renewals". I'm looking for a method that resembles $NameSpace.GetFolderFromPath("\\Archive\Renewals") and I haven't seen anything like it. It seems like there is something very simple that I am missing, and could use some help in that regard. Thanks for reading. Edited September 9, 2008 by Vakari Link to comment Share on other sites More sharing options...
jbg1978 Posted September 9, 2008 Share Posted September 9, 2008 I believe Namespace.Folders("Main Folder").Folders("Sub Folder 1").Folders("Sub Folder 2") etc., etc. should work Link to comment Share on other sites More sharing options...
Pain Posted September 9, 2008 Share Posted September 9, 2008 I'm not sure but maybe this can help youhttp://www.autoitscript.com/autoit3/docs/appendix/clsid.htm Link to comment Share on other sites More sharing options...
RDSchaefer Posted September 10, 2008 Share Posted September 10, 2008 I believe Namespace.Folders("Main Folder").Folders("Sub Folder 1").Folders("Sub Folder 2") etc., etc. should workThis is the correct answer. I've been using AutoIt to pull emails from our shared folders at work for a while now and that's how I do it. Link to comment Share on other sites More sharing options...
Vakari Posted September 10, 2008 Author Share Posted September 10, 2008 Awesome sauce! Thank you all very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now