c# - How to programmatically select a folder to view in Outlook 2010? -
i programmatically creating search folder via search.save method. after save search (it creates new folder in search folders directory), set focus on newly created folder such view changes folder.
this code have far....
searchfolders = inboxfolder.store.getsearchfolders(); foreach (outlook.folder folder in searchfolders) { if (folder.name == "expiring retention policy mail") { folder.showitemcount = microsoft.office.interop.outlook.olshowitemcount.olshowtotalitemcount; //folder.setcustomicon(new bitmap(32, 32)); folder.display(); } }
when folder.display() opens entirely new inspector window... don't want happen, want select (like via set focus?) , have viewed in same inspector window exists in. know how this?
thank you.
this should work you...
get access application
object (or main add-in class). ,
this.application.activeexplorer().currentfolder = folder;
i.e. can use currentfolder
of activeexplorer
of course, always make sure release com objects (the ones need releasing) - , should never did here (for simplicity) - i.e. chaining properties that. save each (property) variable, , release via
marshal.releasecomobject
on way out.
Comments
Post a Comment