Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to load a pst file(data file)programmatically

444 views
Skip to first unread message

Robert wang

unread,
Jul 6, 2005, 10:43:01 PM7/6/05
to
I need to open a pst file to get the calendar data inside,
I need c++ code, of course , vba code is welcome,
thanks for any help.

Dmitry Streblechenko

unread,
Jul 7, 2005, 2:06:37 AM7/7/05
to
Outlook Object Model: Namespace.AddStore
Extended MAPI: add a "MSPST MS" service to the current profile and configure
it supplying the PR_PST_PATH and PR_DISPLAY_NAME properties.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message
news:DF728B5F-757B-4CAA...@microsoft.com...

Robert wang

unread,
Jul 7, 2005, 4:56:03 AM7/7/05
to
I can't understand the words, please give me more details.
thanks

> Extended MAPI: add a "MSPST MS" service to the current profile and configure
> it supplying the PR_PST_PATH and PR_DISPLAY_NAME properties.

Robert wang

unread,
Jul 7, 2005, 5:55:06 AM7/7/05
to
Namespace.AddStore have no return value,
I can add a pst to current profile,
then how I access the folder that I added,
I want to get the calendar data in the pst which i added.

Dmitry Streblechenko

unread,
Jul 7, 2005, 2:11:20 PM7/7/05
to
You need to use the Namespace.Folders collection (returns the top level
folders of all stores in the profile).
Once you have the top level folder (MAPIFolder) of the new store, you can
access its subfolders using the MAPIFolder.Folders collection.
BTW, Outlook Object Model questions are better answered in one of the OOM
newsgrousp, such as microsoft.public.outlook.program_vba or
microsoft.public.office.developer.outlook.vba.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:D023900D-0E24-4A32...@microsoft.com...

Thomas Quester

unread,
Jul 7, 2005, 2:33:15 PM7/7/05
to
The easiest trick: Just call OpenEntry with the Store Entry ID of a PST
file, this should also work with CDO and Outlook API.

You can construct the store entry ID of any file, just look at the binary
code, it contains the path name, for Unicode files take

"0000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E00000000"
and add the file name in unicode format, for example
43003A005C006D006100 .. 0000
C : \\ m ... etc. \0

Note: This only works for PST files.

Thomas Quester

"Robert wang" <Rober...@discussions.microsoft.com> schrieb im Newsbeitrag
news:DF728B5F-757B-4CAA...@microsoft.com...

Robert wang

unread,
Jul 11, 2005, 4:24:01 AM7/11/05
to
sorry, I was confused,
how can I get the top level folder of the new store?
Namespace.Folders output all MAPIfolders, how I
get the one from the collection?

Thomas Quester, can you give me a details,
I can't catch your meaning.
thanks anyhow.

Dmitry Streblechenko

unread,
Jul 11, 2005, 12:51:28 PM7/11/05
to
You can call Namespace.AddFolders and hope that the newly added PST will be
the last in the Namespace.Folders collection (breaks at least 30% of the
time)
A better way of doing that is to loop through all folders in the
Namespace.Folders collection and store their MAPIFolder.StoreID property in
a list/array. Call Namespace.AddFolders. Loop through Namespace.Folders
collection again. The folder with a StoreID property not in the list is the
newly added store.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:C6EEB9F5-DA9E-458F...@microsoft.com...

Robert wang

unread,
Jul 12, 2005, 1:38:13 AM7/12/05
to
I understand what you said, however, my program will load the specified pst
file,
so the pst file might have been the folder of the currrent profile,that is
to say,
this way can't be trusted,if there is some way to get the fold object's path
name,
there can compare there path name to get the folder object.
thanks anyhow.

Dmitry Streblechenko

unread,
Jul 12, 2005, 2:37:20 AM7/12/05
to
You can use the MAPIFolder.FolderPath property, but it is not quaranteed to
be unique.
If the PST file is already in the current profile, it won't be added twice
by AddStore(). You can check that the Namespace.Folders.Count is the same
before and after calling AddStore to check for that case.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:B81EBA27-4728-4F67...@microsoft.com...

Robert wang

unread,
Jul 12, 2005, 2:55:02 AM7/12/05
to
MAPIFolder.FolderPath seems not the pst file path.
by compare the count of folders,I can assure that
the pst file is already in the current profile, however
how can I get the MAPIfolder,because I only know the
pst file path,how can I know which folder it is related with.
thanks.

Dmitry Streblechenko

unread,
Jul 12, 2005, 12:42:04 PM7/12/05
to
For a PST store already in the profile, you cannot get the store path of a
given folder without using Extended MAPI (grab the store entry id, go to the
profile data, find a PST provider with the same value of the store entry id,
read PR_PST_PATH)
What I suggested before only applies to adding new PST files using
Namespace.AddStore.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:F7403E48-A25C-49CE...@microsoft.com...

Robert wang

unread,
Jul 13, 2005, 1:27:03 AM7/13/05
to
I have studied the IMAPIFolder,but it only has the property PR_DISPLAY_NAME,
I can't find the property PR_PST_PATH,by the way, I don't undertand the
words blew:

"Extended MAPI: add a "MSPST MS" service to the current profile and configure
it supplying the PR_PST_PATH and PR_DISPLAY_NAME properties."
Can you give me more information about Extended MAPI,thanks.

Dmitry Streblechenko

unread,
Jul 13, 2005, 1:28:29 PM7/13/05
to
PR_PST_PATH is stored in th profile data, not in the folder itself.
If you have OutlookSpy installed, click IMAPISession, AdminServices, select
the PST store in the GetMsgServiceTable tab, click AdminProviders, in the
IProviderAdmin window double click on the provider.
What language are you using? Note that Extended MAPI can only be used from
C++/Delphi, not from VB.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:7FEC8F1E-4C5A-418B...@microsoft.com...

Robert wang

unread,
Jul 14, 2005, 4:15:01 AM7/14/05
to
I want to ask you if the Extended MAPI interface can do the
work that reading calendar data from pst file,
or I need combine MAPI and Outlook object model,
I have outlookSpy installed, and I have found the property
PR_FOLDER_DN_W, it is the pst file path, and how to
use MAPI to open a pst file just like addStore, It seems
complicated, if there is a sample code, It is exciting.

Dmitry Streblechenko

unread,
Jul 14, 2005, 1:06:33 PM7/14/05
to
What do you mean by "that reading calendar data from pst file"?
Whatever Outlook does, you can (at least in principle) do from Extended
MAPI, that's Outlook's native API.
I am not aware of any sample code that reads the PST path given the store
entry id. I did this in one of my projects, but I cannot share its source,
sorry, it does not belong to me.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:090C214F-85BB-4139...@microsoft.com...

Robert wang

unread,
Jul 14, 2005, 9:51:01 PM7/14/05
to
that is appointment, get all the information about the appointment item in
the pst file,
I can stand on yourside, would you give me some more hint?
for example , whether It can get the appointment information by MAPI,
because I think MAPI is for the Mail object, and it gets better if you can
show me the
MAPI interfaces which would help me do the work.

Dmitry Streblechenko

unread,
Jul 15, 2005, 12:44:37 AM7/15/05
to
From the Extended MAPI point of view, there is absolutely no difference
between regular messages, appointments or tasks. They are all IMessage
Extended MAPI object, the only difference is a set of properties. For the
appointment items, most interesting stuff is stored in the named propeties.
Look at appointments with MdbView or OutlookSpy (click IMessage button on
the OutlookSpy toolbar to see the properties of the selected item in
Outlook).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Robert wang" <Rober...@discussions.microsoft.com> wrote in message

news:444BB53D-D442-4625...@microsoft.com...

0 new messages