Creating an unicode .pst file

Oct 17, 2007 at 1:42 PM
Hello together,

I'm trying to change our existing C++ code from creating an ANSI .pst file to a 2003+ unicode .pst file. It should be as easy as changing the service provider name for IMsgServiceAdmin::CreateMsgService from "MSPST MS" to "MSUPST MS", but I always end up with an ANSI .pst file. I've searched around the net and found several people exeperiencing the same trouble and no solution like this: http://www.ureader.com/message/1037445.aspx

I tried playing around with mfcmapi and there the creation of an unicode PST works out of the box. After taking a look at mfcmapi's source, I saw something interesting: Before calling CreateMessageService() it marks the existing providers with a dummy property so it can later search for an unmarked provider (=our new one) via FindUnmarkedProvider(). Why does it do that? Is there a better way to get the GUID of the freshly created service?

Right now I'm calling a custom function called OpenService("MSUPST MS") before ConfigureMsgService() that returns the GUID of the default "MSUPST MS" service. I'm going to change the code now to the mark approach thought I'm curios why that is needed.

Thanks in advance,
Thomas
Coordinator
Oct 19, 2007 at 9:34 PM

tjarosch wrote:
Why does it do that? Is there a better way to get the GUID of the freshly created service?

If there's a better way, I haven't found it. One of the holes in the MAPI spec is that CreateMessageService doesn't return the GUID of the service it created. So the only way to find the new service is to know what all the existing services were before the call. One approach would be to enumerate them and maintain a list of guids, then after the call look for the guid that's not in your list. I chose a different approach - stamp them all and then look for the one without the stamp.

Either approach should work.
Oct 22, 2007 at 8:06 AM
Edited Oct 22, 2007 at 8:14 AM
Thanks for explaining the creation process via CreateMessageService().

I found out the mystery why the creation of a unicode .pst failed: I transfered the property array for ConfigureMsgService() from my code into MFCMAPI and it stopped working.

My code had a property PR_PST_ENCRYPTION which was set to PSTF_NO_ENCRYPTION. After removing that property it created a unicode .pst instead of an ANSI .pst. I took a look again at the code from other people with the same problem and voila, they also set the PR_PST_ENCRYPTION property.