1

I'm attempting to set (actually clear) the PR_PST_PASSWORD property on a PST file using Redemption thusly:

RDOSession session = new RDOSession();
RDOPstStore store = session.LogonPstStore(sourcePstPath,Type.Missing,Type.Missing,password);
Int32 PR_PST_PASSWORD = 0x67ff0003;
store.Fields[PR_PST_PASSWORD] = 0x00000000;

That last line throws this exception:

System.UnauthorizedAccessException was unhandled
HResult=-2147024891
Message=Error in HrSetOneProp: MAPI_E_NO_ACCESS

Is there a way I can set this property?

Roger Harvest
  • 460
  • 5
  • 16

1 Answers1

1

Firstly, PST password needs to be supplied when the PST service is configured when a PST store is being added. It is definitely not stored as a property on the store itself.

Secondly, I have never seen 0x67ff0003 property. I know of PR_FAIMsgFolderPropTagArray and PR_ServerName properties, but they are of type PT_BINARY (0x67FF0102), not PT_LONG.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Per MSDN the PidTagPstPassword property stores the hash of the password text (see http://msdn.microsoft.com/en-us/library/ff385916(v=office.12).aspx). Per the ASPOSE.Email documentation (http://www.aspose.com/docs/display/emailnet/Check+if+a+PST+is+password+protected) I can query this property to tell if it is password protected or not. I need to clear this property so a process can run downstream on the pst file. Is there a way to clear this with Redemption? Thanks Dmitry. – Roger Harvest Dec 03 '14 at 21:06
  • That property is not exposed on the IMsgStore MAPI object. It is only stored in the PST file itself. Since Aspose does not use MAPI to access PST files, they are free to expose it as a separate property. MSPST provider does not do that - you can only change the password when the PST is being added to the profile - MSPST provider lets you specify the old and new passwords. – Dmitry Streblechenko Dec 03 '14 at 22:06
  • Thanks Dmitry. you say "you can only change the password when the PST is being added to the profile" - is there a way I can do that with Redemption? – Roger Harvest Dec 03 '14 at 22:37
  • Redemption does not explicitly support that, but you call RDOSession.Stores.AddPstStoreWithPassword with the old password, remove the store, then try to call AddPstStoreWithPassword with the new password. – Dmitry Streblechenko Dec 04 '14 at 22:05