Add PST to profile with MFCMAPI?

Oct 3, 2008 at 2:55 PM
Can you use MFCMAPI to add a PST to a profile on an Exchange server?  I have a need to export items to a PST without using Outlook, since I am working on an Exchange server.  Any ideas?

Oct 3, 2008 at 3:12 PM
Oct 3, 2008 at 4:58 PM
thanks steve.  now the only question is, how?
Oct 3, 2008 at 5:18 PM
Open the profiles dialog and look at the actions menu - add PST is an option.
Oct 3, 2008 at 5:26 PM
Is it possible to create one from scratch with MFCMAPI?
Oct 3, 2008 at 5:39 PM
Yes - same method - just give the file name you want and it'll create it.
Oct 3, 2008 at 7:56 PM
I tried adding a Unicode PST to the default MS Exchange Settings profile I created with the profiles wizard and I get the following error (after picking a new filename to be created on the desktop):

Code: MAPI_E_NO_ACCESS == 0x80070005
Function lpSect->SetProps(1,&PropVal,NULL)
File .\MAPIProfileFunctions.cpp
Line 533

I definitely have the appropriate permissions to create such a file on the desktop, and this is the same account that created the profile.  Any ideas?
Oct 3, 2008 at 8:03 PM
Exchange's PST provider doesn't know anything about Unicode PSTs - you'll have to use regular PST.
Nov 6, 2008 at 2:13 PM
Finally getting back to this.  Tried a non-Unicode PST and that gave the same error, although it actually added an entry to the root menu's list of stores.  Clicking on the PST store results in a MAPI Unconfigured error.  No joy.
Dec 1, 2008 at 7:56 PM
Saw that the November release had a PST fix, so I tried it again.  Now I get this error trying to add a (non-Unicode) PST which does not yet exist:

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta content="OneNote.File" name="ProgId" /> <meta content="Microsoft OneNote 12" name="Generator" />

F! MFCMAPI Sample Version sII fl
Error: Could not add service to profile Perhaps service is not in MAPISVC.INF?
Function IpserviceAdmin- >CreateMsgservice( (LPTSTR)lpszserviceName, (LPTSTR)lpszserviceName, ulUlParam, ulFlags)
File .MAPIPro1ileFunctions.cpp
Line 605

This is text translated by OneNote, my apologies for its typos.

Dec 1, 2008 at 8:08 PM
Did you check MAPISVC.INF? Did it have the MSPST service in it? I have a routine, Profile/Add Services to MAPISVC.INF that will add the MSPST service to MAPISVC.INF if that's the problem.