vba - How to retrieve Outlook Mail items using R RDCOMClient? -


i have been using r's rdcomclient package manipulate excel files , has been tremendous help.

now venturing on using outlook , have learned how send mail using thread here

however, want use r's rdcomclient retrieve messages inbox.

in general, can convert vba code use rdcomclient, though having trouble in cases proper syntax.

i.e. when access member of object using object[["example"]] or object$example(); , how make object$example(test$()) work.

more specifically, how convert following code msdn on retrieving mail using vba?

    dim outlooknamespace outlook.namespace dim inbox outlook.mapifolder dim withevents items outlook.items  private sub thisaddin_startup() handles me.startup      outlooknamespace = me.application.getnamespace("mapi")     inbox = _         outlooknamespace.getdefaultfolder( _         outlook.oldefaultfolders.olfolderinbox)     items = inbox.items  end sub   private sub items_itemadd(byval item object) handles items.itemadd     dim filter string = "used cars"      if typeof (item) outlook.mailitem          dim mail outlook.mailitem = item         if mail.messageclass = "ipm.note" , _  mail.subject.toupper.contains(filter.toupper)             mail.move(outlooknamespace.getdefaultfolder( _                 outlook.oldefaultfolders.olfolderjunk))         end if      end if   end sub 

here made attempts in r like:

ol = comcreate("outlook.application") outlooknamespace = ol$getnamespace("mapi") 

with ideas of following logic presented in vba code. however, run problems mentioned above syntax accessing members , methods not translated.

    subpath = ol$oldefaultfolders()$olfolderinbox() ##or     subpath = ol$defaultfolders()     subpath2 = subpath$olfolderinbox() 

ultimately, question (and 1 potentially posed others) can best direct conversion of msdn example vba r, or link comprehensive tutorial.

and record have read this great tutorial on rdcomclient

i appreciate can give me, , think topic great launchpad general vba -> rdcom ideas


Comments

  1. Thanks for this helpful blog about Outlook mail and I’m lucky to find out this blog because I always need this kind of blog. For any technical support call 0800-090-3220 or visit the website Outlook Contact Number UK

    ReplyDelete

Post a Comment

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -