|
|
|
| Author |
Message |
ew
Joined: 05 Aug 2007 Posts: 3
|
Posted: Mon Nov 20, 2006 7:25 am Post subject: How to extract outlook basic information by C++ |
|
|
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...
Archived from group: microsoft>public>exchange>applications |
|
| Back to top |
|
 |
Dan Mitchell
Joined: 05 Aug 2007 Posts: 42
|
Posted: Mon Nov 20, 2006 9:49 pm Post subject: Re: How to extract outlook basic information by C++ |
|
|
=?Utf-8?B?ZXc=?= wrote in@microsoft.com:
> 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.
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 |
|
| Back to top |
|
 |
ew
Joined: 05 Aug 2007 Posts: 3
|
Posted: Tue Nov 21, 2006 3:47 am Post subject: Re: How to extract outlook basic information by C++ |
|
|
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?
lastly, sorry for my poor english.
"Dan Mitchell" wrote:
> =?Utf-8?B?ZXc=?= wrote in
> @microsoft.com:
> > 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.
>
> 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
> |
|
| Back to top |
|
 |
Dan Mitchell
Joined: 05 Aug 2007 Posts: 42
|
Posted: Tue Nov 21, 2006 2:26 pm Post subject: Re: How to extract outlook basic information by C++ |
|
|
=?Utf-8?B?ZXc=?= wrote in@microsoft.com:
> 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.
> - 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".
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?
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 |
|
| Back to top |
|
 |
ew
Joined: 05 Aug 2007 Posts: 3
|
Posted: Tue Nov 21, 2006 11:11 pm Post subject: Re: How to extract outlook basic information by C++ |
|
|
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. ^^ |
|
| Back to top |
|
 |
Dan Mitchell
Joined: 05 Aug 2007 Posts: 42
|
Posted: Wed Nov 22, 2006 1:59 pm Post subject: Re: How to extract outlook basic information by C++ |
|
|
=?Utf-8?B?ZXc=?= wrote in@microsoft.com:
> 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
|
|
| Back to top |
|
 |
|
|