Connecting to Outlook 'Saved Items' folder using win32ole

Discussion in 'Ruby' started by Alex DeCaria, Dec 12, 2007.

  1. Alex DeCaria

    Alex DeCaria Guest

    Can anyone tell me how to connect to the 'Saved Items' folder in Outlook
    using WIN32OLE? I can get to all the other folders using
    GetDefaultFolder(), but I can't seem to get to the 'Saved Items' folder
    this way. mapi.Folders.Item('Saved Items') doesn't do it either.

    Thanks in advance. Alex
     
    Alex DeCaria, Dec 12, 2007
    #1
    1. Advertisements

  2. I'm curious. Are you connecting to Outlook through an Exchange Server
    or a stand-alone client?

    Bill
     
    Bill Davenport, Dec 12, 2007
    #2
    1. Advertisements

  3. Alex DeCaria

    Alex DeCaria Guest

    Bill,

    I'm connecting through an exhange server. I am able to access my inbox,
    deleted items, etc., and also my 'personal folders'. I just can't
    figure out how to get to the 'saved items'.

    Alex
     
    Alex DeCaria, Dec 12, 2007
    #3
  4. Alex,

    I have ubuntu and if I open a file browser and you should be able to
    connect the Exchange server. This will let you view the contents of your
    Sent Items.
    dav://<owa link>/exchange/<user account>/Sent%20Items

    I haven't used the win32ole so I chose to use what Exchange uses
    natively -- WebDAV. I hope this helps.

    If you know what you're looking for within the Sent Items folder I have
    some code.
     
    Bill Davenport, Dec 12, 2007
    #4
  5. Alex DeCaria

    Alex DeCaria Guest

    Alex,
    Bill,

    Thanks for your time and patience. It's actually the 'Saved Items' that
    I'm trying to access, not the 'Sent Items' (which I am able to access).
    Underneath the 'Saved Items' I have a bunch of sub-folders where I am
    storing e-mails that are kept on our server. If I move one of those
    folders into the 'Personal Folders' I can then access it, but then it is
    on my local machine and no longer on our server.

    So my issue is, I can get to 'Inbox', 'Sent Items', 'Appointments',
    'Deleted Items', and 'Personal Folders', but just not 'Saved Items'.

    I think my issue is a WIN32OLE issue, but again I thank you for your
    time in trying to help.

    - Alex
     
    Alex DeCaria, Dec 12, 2007
    #5
  6. I misread. Is 'Saved Items' a folder you created. Look at the structure
    I don't see it. I don't see it in OWA or in Outlook either.

    bill
     
    Bill Davenport, Dec 12, 2007
    #6
  7. Alex DeCaria

    Alex DeCaria Guest

    Bill,

    Yes, actually it is one I created. I should have been more specific.
    But I did create it on the server-side of things, so it resides as a
    subfolder under my 'Mailbox'. I'm now thinking that may be why I can't
    access it, because maybe WIN32OLE can't recognize it.

    Alex
     
    Alex DeCaria, Dec 12, 2007
    #7
  8. I created a 'Saved Items' and was able to access it using WebDAV.

    Try this in irb.

    require 'uri'
    require 'net/http'
    include Exchange
    uri_path = URI.parse("http:////<owa link>/exchange/<user
    account>/Sent%20Items/<filename>.eml")
    request = Net::HTTP::Get.new(uri_path.path, {"translate" => "F"})
    login = "login"
    pass = "password"
    request.basic_auth(login, pass)
    response = Net::HTTP.start(uri_path.host) {|http| http.request(request)}
    response.body

    BTW: I have to leave on a trip. Good luck with you project.

    -bill
     
    Bill Davenport, Dec 12, 2007
    #8
  9. include Exchange

    OOPS: DO NOT USE THE "include Exchange". That was a typo.
     
    Bill Davenport, Dec 12, 2007
    #9
  10. Alex DeCaria

    Alex DeCaria Guest

    Bill,

    OK. Thanks for the help. I'll give it a try! Enjoy your trip.

    Alex
     
    Alex DeCaria, Dec 12, 2007
    #10
  11. Alex DeCaria

    Alex DeCaria Guest

    Bill,

    As closure, I did figure out a way to do this in Windows using WIN32OLE.
    The attached program will locate a folder in the Outlook Mailbox, and
    then print the names of any subfolders in the folder as well as the
    subjects of any messages in the folder.

    Thanks again for taking the time to help.

    Alex

    Attachments:
    http://www.ruby-forum.com/attachment/1141/outlook_explore.rb
     
    Alex DeCaria, Dec 13, 2007
    #11
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.