Parse and manipulate pst files in C#

H

Hemant

At present, we're working on a C# 2005 proj in which we need to retrive the
original Outlook pst files and thoroughly parse them. The proj is about
maintaining a mirror-image of the original Outlook pst file which can be
sync'ed frequently (rather then creating a huge pst file backup).

The real problem is that we need to support Outlook version 2000 and later -
so we're in search of some 'generalized APIs' which can support all the
versions of Outlook. We've tried MAPI, CDO, mapi32.dll, mapi33.dll but none
are consistent and it seems a bit risky to move ahead with them. We also
found links about "Outlook Object Library" but again it is Outlook-version
specific.

There'er a lot of diff approaches and there're many code-snippets using diff
approaches to access Outlook/MAPI, like:

# OOL (Outlook Obj Lib) - though its version specific but if we can create a
dll for each version and then replace the dll as per the version installed on
user's machine then it might work. The quetion is - does it really have good
support for manipulating pst files?

# mapi33.dll & Outlook Redemption - Paid 3rd party options. mapi33.dll says
it is the most optimized approach but I'm not sure how compatible and stable
it is! The same is true for Outlook Redemption (but they have APIs for pst
files). Besides I'm also concerned about the security exceptions. Anything
you know?

# Pinvoke + mapi32.dll - In this approach we use the "Platform
Invoke"(Pinvoke) feature available in .net to access the mapi32.dll directly
(which is otherwise not possible because mapi32.dll is a native dll) - again
not sure how stable this is.

# Misc - Refer CDOSYS.dll, etc.. , 3rd Party tool AddinExpress, etc... but
they don't seem to provide such a magnitude when it comes to features.

I'm a newbie to Outlook programming and I see a lot of diff ways to move
ahead with this proj but from what I've been researching on the net - it
seems that some of the approach might be good initially but they break-down
later on! So, instead of me "reinventing-the-wheel" - if I could have a
little help I'll know in which direction can I dig further.

Any help and/or suggestions will be greatly appreciated.
 
K

Ken Slovak - [MVP - Outlook]

Any direct use of Extended MAPI in managed code is not supported, so ignore
that option.

I use Redemption all the time and if you set AuthKey and customize the DLL
with custom CLSID's then it's as secure as can be and definitely will allow
you to what you want.

The Outlook object model is always the way to go if the oldest version of
Outlook you need to support has the methods and properties you need for what
you want to do. The rule of thumb is to develop using references to the
oldest Outlook object model tlb and that code will run without change on
older versions. However, I generally counsel against using managed code for
support of Outlook 2000 and 2002 due to deficiencies and bugs in the PIA's
for those versions of Outlook.

All in all, in your situation, I'd go with Redemption myself.
 
H

Hemant

Ken Slovak - said:
Any direct use of Extended MAPI in managed code is not supported, so ignore
that option.

I use Redemption all the time and if you set AuthKey and customize the DLL
with custom CLSID's then it's as secure as can be and definitely will allow
you to what you want.

The Outlook object model is always the way to go if the oldest version of
Outlook you need to support has the methods and properties you need for what
you want to do. The rule of thumb is to develop using references to the
oldest Outlook object model tlb and that code will run without change on
older versions. However, I generally counsel against using managed code for
support of Outlook 2000 and 2002 due to deficiencies and bugs in the PIA's
for those versions of Outlook.

All in all, in your situation, I'd go with Redemption myself.
 
H

Hemant

# Cloning Outlook pst:
This is what the app is about - we're going to clone the Outlook pst and
maintain a mirror image. Initially we'll need to clone the structure and copy
each item from the original Outlook pst. This is the first time the user
accesses our app. For each subsequent access we'll only compare both the psts
and add what is new in the Outlook pst. This is like physically maintaining a
backup copy of the original pst.
The idea is to kep this copy in a flash-drive which will make everything
portable (we don't want that everytime the user wants to carry all his email
- he needs to copy-paste the huge pst file - it is sensitive so we dn't want
to touch it)
I hope this makes sense.

We've started with two approaches -
# OOL (Outlook Obj Lib)
# OR (Outlook Redemption)
but honestly speaking the resources on net are scarce. I mean there's no
detailed or clear sample but its hard to find.

We're newbie. I see this is just the begining and there's a lot more coming
for us - it'll be a steep learning curve. Can you provide us some material or
some online documentation where we can expect to dig less and get more.
 
K

Ken Slovak - [MVP - Outlook]

Most of the Redemption code samples are on the Redemption Web site. For
other code samples see www.outlookcode.com. Those are the best resources for
what you're doing.
 
H

Hemant

If you were suppose to work on this proj - that is mirror the original
Outlook pst and then your app will kep it "sync'ed" with the original Outlook
pst as and when you open that app and it'll also allow manipulating that
mirror-pst in the same manner as in Outlook (i.e. only move, archive and
delete). and some otehr features around pst and also manipulating the
Original Outlook pst.

- in such case what kind of approach would you prefer and which platform
will you prefer. Our proj is in the initial phase and hence I've not
concluded anything, as .Net v3.5 is the latest tech - we intended to use it.
Infact this is the first case when we've realized that somethings are better
in native code(vb6/c++).

Pls tell me what technology, platform and tools would you suggest.
 
H

Hemant

We're planning to use Outlook Redemption library for our Outlook product. Our
proj is in C# 2005. We've tested some initial pst-processing using the
developer version of OR and it seems to be working fine. Based on your
expertise and exprience I'd like to clear some of my doubts:


#1. Firstly I'd like to know if it'll work fine on the .Net platform in
long-term (i.e. for extended functionalities)?
#2. Would you prefer using vb6 over C#/vb.Net due to any reason (because
Extended MAPI being unmanaged code is NOT supported in .Net)
#3. If you can tell me honestly whether we shud go for OR or use the MAPI in
vb6 for this proj - I'll trust you on this one.
#4. Ours is a windows app - so how can we ship OR with our app? What about
liscensing/cost for such product development - any idea?
#5. Can we expect full technical support once we're 'liscensed'?

Thank you.
 
K

Ken Slovak - [MVP - Outlook]

#1. I use Redemption all the time with managed code, and specifically with
C#.

#2. Since I don't code directly in Extended MAPI (C++ or Delphi only) I use
Redemption in both unmanaged code (VB6/VBA/VBScript) as well as with managed
code (C#, VB.NET).

#3. Since Extended MAPI can only be directly programmed using C++ or Delphi
(other than some hacks using VB) I don't think that's an option.

#4. You deploy Redemption just as you would any other DLL, how depends on
the installer you're using. I'm not sure about licensing costs for the
developer version of Redemption, you'd have to contact them for that
information. Just make sure to use the AuthKey property and to customize the
class names and CLSID's for Redemption to make it fully secure and immune
from interaction with other programs using Redemption.

#5. Dmitry is real good at providing support.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top