c# - Using Outlook API to get to a specific folder -
i'm trying write c# code specific folder in outlook mailbox. have following code:
outlook.application oapp = new outlook.application(); outlook.namespace ons = oapp.getnamespace("mapi"); outlook.recipient orecip = ons.createrecipient("accountnamehere"); orecip.resolve(); if (orecip.resolved) { oinbox = ons.getshareddefaultfolder(orecip, outlook.oldefaultfolders.olfolderinbox); oinboxmsgs = oinbox.items; itemcount = oinboxmsgs.count; console.writeline("there {0] items.", itemcount.tostring()) }
this me to "inbox" folder. i'm trying folder @ same level inbox folder. believe need use getfolderfromid instead of getshareddefaultfolder, don't understand how use it. there way iterate through top level folders? how might determine entryid , storeid of folder?
thanks!
you can use folders collection member of outlook.namespace object. way can iterate through collection , find folder it's name. in case still want use getfolderfromid, can use outlookspy tool entryid , storeid values.
Comments
Post a Comment