Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > MAPI Logon

Reply
Thread Tools

MAPI Logon

 
 
Jeff Miller
Guest
Posts: n/a
 
      03-26-2008
Hello,
I'm trying to start up a MAPI session and get my project rolling...
However, when I run my code below (it's supposed to just log in) I get
an error telling me that 'MAPI.Session' is an unknown OLE server... My
code is borrowed, but is as follows:

require 'win32ole'
mapiSession = WIN32OLE::new('MAPI.Session')
WIN32OLE.const_load(mapiSession, MapiConst)
exchangeServer = 'ex'
mailbox = 'galthis'
logonParam = "ProfileInfo:="+ exchangeServer + "\r" + mailbox
mapiSession.Logon(logonParam)

This kicks me the error:
test_mapisession.rb:3:in `initialize': unknown OLE server:
`MAPI.Session' (WIN32OLERuntimeError)
HRESULT error code:0x800401f3
Invalid class string from test_mapisession.rb:3:in `new'
from test_mapisession.rb:3

I don't know what I'm doing wrong, or if I need something else installed
on my machine, I don't know... I can access MAPI outlook stuff using
WIN32OLE.new('Outlook.Application'), but for some reason MAPI.session
doesn't work... Any ideas?

Any help is appreciated!

Thanks,
- Jeff
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jeff Miller
Guest
Posts: n/a
 
      03-26-2008
this is actually simpler to read, sorry-

so now I've got a simple 2-liner like so:

require 'win32ole'
mapiSession = WIN32OLE.new('Mapi.session')

with this error:
test_mapisession.rb:3:in `initialize': unknown OLE server:
`Mapi.session' (WIN32OLERuntimeError)
HRESULT error code:0x800401f3
Invalid class string from test_mapisession.rb:3:in `new'
from test_mapisession.rb:3

Any suggestions?

Thanks,
- Jeff
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
David Mullet
Guest
Posts: n/a
 
      03-27-2008
Jeff Miller wrote:
> this is actually simpler to read, sorry-
>
> so now I've got a simple 2-liner like so:
>
> require 'win32ole'
> mapiSession = WIN32OLE.new('Mapi.session')
>
> with this error:
> test_mapisession.rb:3:in `initialize': unknown OLE server:
> `Mapi.session' (WIN32OLERuntimeError)
> HRESULT error code:0x800401f3
> Invalid class string from test_mapisession.rb:3:in `new'
> from test_mapisession.rb:3
>
> Any suggestions?
>
> Thanks,
> - Jeff


I think you may need to have CDO (or CDONTS) installed separately in
order to call access the MAPI namespace directly. I think MAPI.Session
resides in the CDO.dll file.

Otherwise, you can call it through Outlook (assuming you have Outlook
installed):

require 'win32ole'
outlook = WIN32OLE.new('Outlook.Application')
mapi = outlook.GetNameSpace('MAPI')

http://rubyonwindows.blogspot.com/search/label/outlook

Hope that helps.

David

http://rubyonwindows.blogspot.com
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Jeff Miller
Guest
Posts: n/a
 
      03-27-2008
Thanks guys, that helped!

I am now on a dev box that has Exchange System Manager installed, giving
me access to MAPI32 and CDO. My session and logon work great now, but I
can't seem to get any further using the same type of code that I used
for Outlook MAPI previously. I want to return a list of folders, but
nothing I've tried seems to work.

When I do the following:
require 'win32ole'
session = WIN32OLE.new('Mapi.session')
session.logon('profilename')

What can I use to gain access to mailboxes? Previously, for Outlook
MAPI, I used:

outlook = WIN32OLE.new('Outlook.Application')
mapi = outlook.GetNameSpace('MAPI')
mailbox = mapi.Folders.Item("Mailbox - USERNAME")
contacts_folder = mailbox.Folders.Item("Contacts")

Where 'mailbox' defines which mailbox to use. However, I don't think I
can do that the same way for Exchange MAPI. Does anyone know how to do
this or have any experience with it?

Any and all help is appreciated!

Thanks!!!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Help: Logon vs Account Logon, Local Logon vs Authentication CJH Microsoft Certification 0 01-04-2006 04:03 PM
MAPI extension for non-MAPI enabled email clients? hugh jass Computer Support 0 02-11-2005 12:20 PM
MAPI.Profile Logon with ASP Adam Kinney ASP General 2 02-11-2004 03:52 PM
Mapi Logon problem Suganthi C++ 1 07-21-2003 03:01 PM
Unable to logon Profile MS Exchange Settings [Collaboration Data Objects - [MAPI Pat Sinnott ASP .Net 0 07-07-2003 11:21 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57