How to get Attached files from MS Outlook PST file.

with using Extended Messaging API or using Mailbox SDK API.

Extended Messaging API (EMAPI).
- Call EMAPI function MAPIInitialize (msmapi32.dll).
- Create a new profile to connect to message store causing MAPIAdminProfiles (0, IProfAdmin), after IProfAdmin.CreateProfile (NewProfileName, 0, 0, 0).
- Registered as a message service IProfAdmin.CreateMsgService (ServiceID, ProfileName, 0, ERVICE_UI_ALLOWED).

Now interface is ready for work, you need to list all the folders inside your storage (PST file):
- You need to get a root folder using the IMsgStore interface - IMsgStore.OpenEntry (0, 0, TGUID (IID_IMAPIFolder), MAPI_READ, MAPIRootFolderType, IUnknown (MAPIRootFolder)).
- After enumerate all the objects in the root folder, separate folders and objects to list objects of these objects. (use recursion).

For each ordinary found a folder you can transfer the facilities of communications inside the folder (use IMsgStore.OpenEntry).
Every ordinary object get Attach Table with using IMessage.OpenProperty(PR_MESSAGE_ATTACHMENTS, IID_IMAPITable, 0, 0, IMAPITable) and after parsing the properties PR_ATTACH_LONG_FILENAME, PR_ATTACH_NUM, PR_ATTACH_FILENAME.
If the object is Attach file you can get here as binary array
IMessage.OpenAttach(AttachIndex, IID_IAttachment, MAPI_BEST_ACCESS, IAttach)
The IAttach Interface is way to access to IAttachStream interface:
IAttach.OpenProperty(PR_ATTACH_DATA_BIN, IID_IStream, 0, MAPI_BEST_ACCESS, IAttachStream)
just read binary data from IAttachStream and store to file:
IAttachStream.Read(AttachBuffer, Length(AttachBuffer), ReadLength)

Use Mailbox SDK API:

PSTHandle = OpenMailbox ( 'FullPath and PST file name' );
for FolderCount = 0 to GetFolderCount - 1 do
   GetFolderProp (PSTHandle, FolderCount, Folder);
   for MailCount = 0 to Folder.MailCount - 1 do
	for AttachCount = 0 to GetAttachCount(PSTHandle, FolderCount, MailCount)-1 do
		GetAttach(PSTHandle, FolderCount, MailCount, AttachCount, Attach);

In this program code is no COM objects and not fill the complex data structures.
You specify the full path and file name any PST Mailbox files.
Using Mailbox SDK API GetFolderCount you get number of folders inside the Mailbox.
Using Mailbox SDK API MailCount you get a number of emails inside folder.
Using Mailbox SDK API GetAttachCount you get a number of attaches inside email.
Using attach count to turn to each of them.

If you replace PST file MS Outlook, on the DBX file MS Outlook Express, you do not come to change the code, to perform the most these action.
Mailbox SDK API specifically designed for use in VS C++, C# and Delphi.