From: Srinivas Remala Date: 2006-09-29T14:03:48+09:00 Subject: Problem in search folder, HI all, I am software test engineer working Outlook based project, Object by using ruby script is user requested folder should select on already opened outlook. I am able to get this functionality on new outlook launch but I want these functionality on existed outlook. I am posting my script please help me according that. require 'win32ole' olapp = WIN32OLE::new("outlook.Application") class OutlookConst end # load Outlook OLE constants WIN32OLE.const_load(olapp, OutlookConst) mymapi = olapp.GetNameSpace("MAPI") #Get the MAPI Object puts "Enter the name of the folder that you want to focus:" foldername=STDIN.gets #Get the folder name foldername=foldername.strip foldername=foldername.upcase #Remove Leading/Trailing Spaces and convert it to the uppercase myfolder=0 #Initialization folders = mymapi.Folders # Get the Base folder collection folders.each { | folder | if(folder.Name.upcase==foldername) myfolder=folder end subfolder=folder.Folders subfolder.each { | folder1 | if(folder1.Name.upcase==foldername) myfolder=folder1 end sub2folder=folder1.Folders sub2folder.each{ |folder2| if(folder2.Name.upcase==foldername) myfolder=folder2 end } } } if(myfolder==0) puts "No such folder found" else puts "\"myfolder\" is the handle for the required folder " myfolder.Display end #olapp.quit #olapp=nil GC.start Thanking You Srinivas -- Posted via http://www.ruby-forum.com/.