Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Exchange Server / Applications / November 2006

Tip: Looking for answers? Try searching our database.

How to extract outlook basic information by C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ew - 20 Nov 2006 10:25 GMT
Hi,
I am working on a project which aims to drag outlook items and drop to my
application in C++.
Now I can extract the entry ID, subject of the email from the dropping data
and making a shortcut link,
e.g. outlook:00000000D987AA9B7042834CBC9A234986F6B82F04022000

However, my project want to get the author, email received Date, etc.
I made some researches on web, it seems Exchange SDK or MAPI (I am not sure
are they the same api) can retrieve these information.

However, I am not sure which API I should look at. Because there are many
explaination on Exchange Server XXXX.
But we are considering the local Outlook version first, such as Outlook
97/2000/2002/etc.

Does anyone know whether I can use Exchange SDK to do what I want?
or I am looking at a wrong direction? If so, any guideline suggested to me
looking at?
THank you...
Dan Mitchell - 21 Nov 2006 00:49 GMT
> I am working on a project which aims to drag outlook items and drop to
> my application in C++.
[quoted text clipped - 5 lines]
> I made some researches on web, it seems Exchange SDK or MAPI (I am not
> sure are they the same api) can retrieve these information.

I'm not quite sure what you mean by "Exchange SDK". There's edk.lib,
which is a library that uses Extended MAPI, but it's not a very good
plan to try and use the EDK directly, it's old buggy code with linking
problems.

See http://blogs.msdn.com/jasonjoh/archive/2004/08/01/204585.aspx for
more on that.

As for using Extended MAPI, that's fine, though it has a steep learning
curve. Your best bet is to get a copy of Inside MAPI (now out of print,
though available used from amazon/bookfinder/etc, or on CD from
insidemapi.com).

And in particular, you'd want to use IMAPISession::OpenEntry to open
the thing you have, assuming that the link you have above contains the
ENTRYID. A good source of sample code is here:

http://blogs.msdn.com/stephen_griffin/archive/2006/06/07/621138.aspx

-- dan
ew - 21 Nov 2006 06:47 GMT
Dan, Thank you.
The sample is helpful. ^^
Now, I know which MAPI Properties are corresponding and availble to use.

um... actually I am not sure which method I am using now. (EDK or Extended
MAPI or whatever.) So I am not sure whether  it will get risk easily.
However, I should hand on something by tmr.
Therefore, even I found the source of earlier version of MFCMAPI.exe. I
still don't have time to go through all now. :( (hope I will have time to
learn it)

Because of the time limit, I got two questions now. after running the
MFCMAPI and the sample from MSDN.
http://support.microsoft.com/Default.aspx?kbid=304894
(Now I am modifying the MSDN to get the information I want because it is
much shorter and easiler for me to mantain it by my limited understanding of
MAPI or outlook programming)

Q1. When I used both samples, MFCMAPI or the code from msdn, there is a
dialog box popup and asked user to press ok for "logon" to outlook.
- I tried set the "flag" of MAPILogonEx to 0 in MSDN sample, then the popup
dialog does not popup. However, I have to set the Outlook as default browser.
If not, it will fail in calling MAPIInitialize(), and popup a message "Enter
there is o default mal client or the current mail client cannot fulfill the
messaging requrest. Please run Microsoft Outlook and set it as the default
mail client".
- I also tried to set the same (flag = 0)on MFCMAPI, but it gets error when
calling MAPILogonEx ().  I think the sample may assume some flags must on.
such as MAPI_LOGON_UI
- However, when I did the research,  I found a software called UltraRecall.
It can get the info of outlook items (autor, received date, shortcut link --
these fileds are what I want in my current task). When using it, I don't have
to set Outlook as default email viewer and No MessageBox popup waiting me
press enter.
Therefore, I guess a solution should be there. But I don't know is it from
Extended MAPI or where. Does any have idea? thanks...

Q2. From MSDN, MAPIInitialize() can't be called within DllMain function or
any other function that creates or terminates threads. I wonder if I make a
function call where I do the initialization, extraction and uninitialization,
could it be run?
This is my second task. (have to done by tmr. :(, maybe I will know it soon
if I can do the first task)

Thank you first.
PS. "Exchange SDK" <-- I viewed too much pages about outlook programming in
this short period, so I mixed the Exchange server and EDK (is that call
Emebbed Development Kit!?). Actually I want to mention the SDK including
edk.h and its libraries. (it should be called EDK, right? :P

lastly, sorry for my poor english.

> > I am working on a project which aims to drag outlook items and drop to
> > my application in C++.
[quoted text clipped - 26 lines]
>
>  -- dan
Dan Mitchell - 21 Nov 2006 17:26 GMT
> Therefore, even I found the source of earlier version of MFCMAPI.exe.
> I still don't have time to go through all now. :( (hope I will have
> time to learn it)

You will have a _much_ easier time if you try and work out how to do
this stuff yourself. Extended MAPI is not a simple API, but it all does
make sense once you understand it.

> Q1. When I used both samples, MFCMAPI or the code from msdn, there is
> a dialog box popup and asked user to press ok for "logon" to outlook.
[quoted text clipped - 4 lines]
> mail client cannot fulfill the messaging requrest. Please run
> Microsoft Outlook and set it as the default mail client".

Which mail client are you trying to use otherwise? Outlook is the only
mail client that supports Extended MAPI -- you can't use ExMAPI code
with Outlook Express or Thunderbird or Eudora, etc. (Notes has some
support but it's flaky, Groupwise's support is apparently even worse)

> Q2. From MSDN, MAPIInitialize() can't be called within DllMain
> function or any other function that creates or terminates threads. I
> wonder if I make a function call where I do the initialization,
> extraction and uninitialization, could it be run?
> This is my second task. (have to done by tmr. :(, maybe I will know it
> soon if I can do the first task)

I think this will depend on exactly what you're doing -- MAPI is
thread-safe, but the usual threaded app restrictions apply. See this
thread, for example:

http://peach.ease.lsoft.com/scripts/wa.exe?A2=ind9610&L=MAPI-L&P=R12499

and there's a bunch of other discussion of threading in the archives of
mapi-l there -- watch for initializing COM (or MAPI) the correct number
of times. See the documentation (the 'using thread-safe objects' link
from the page you presumably found which mentions DllMain)-- you just
have to call MAPIInitialize once on each thread, and check the
'implementing thread-safe objects' page in the 'threading in MAPI'
section in MSDN for a bit more.


> PS. "Exchange SDK" <-- I viewed too much pages about outlook
> programming in this short period, so I mixed the Exchange server and
> EDK (is that call Emebbed Development Kit!?). Actually I want to
> mention the SDK including edk.h and its libraries. (it should be
> called EDK, right? :P

Read the link on Jason Johnston's blog I posted for more about what's
in edk.h. It's just a bunch of helper functions to make ExMAPI coding
easier, but there are bugs in it and edk.lib is very hard to get to link
properly.  You don't need to use it directly to talk to Outlook, I just
got the source and used it as sample code to help build my apps.

-- dan
ew - 22 Nov 2006 02:11 GMT
Dan, Thank you very much again. ^^

>  Which mail client are you trying to use otherwise? Outlook is the only
> mail client that supports Extended MAPI -- you can't use ExMAPI code
> with Outlook Express or Thunderbird or Eudora, etc. (Notes has some
> support but it's flaky, Groupwise's support is apparently even worse)

um... How's about I use outlook express as default mail client?
anyway If I use Outlook Express as default, the MAPIInitialize() has already
failed to call and pops up a warning message to ask user set Outlook as
default one.
The MAPIInitialize() don't have any parameter to off the message. If so,
will there have any method detecting whether Outlook is the default email
client?

For the MAPILogonEx() problem, I have set the flag of MAPILogonEx() to 0.
ie. MAPI_LOGON_UI is removed. So that the popup dialog, which asked user
confirming connecting to Outlook, is disappeared now. ^^
Dan Mitchell - 22 Nov 2006 16:59 GMT
> um... How's about I use outlook express as default mail client?

If you're using OE as a default client, then you will have to use
Simple MAPI, not Extended MAPI, and then you'll be calling MAPILogon,
not MAPIInitialize, and those problems will go away.

>anyway If I use Outlook Express as default, the MAPIInitialize() has
>already failed to call and pops up a warning message to ask user
>set Outlook as default one.

That's because MAPIInitialize won't talk to OE, it'll talk to Outlook,
because OE doesn't support that API. Then Outlook comes up and says
"hey, I'm not the default mail client", and thus the dialog.

>will there have any method detecting whether Outlook is the
>default email client?

Look in the registry here:

HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\(default).

You may also find more generally useful info here:

http://groups.google.com/groups/search?q=default+mail+client

-- dan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.