none
How to add password protected PST file to PST Store RRS feed

  • Question

  • Hi all,

            I am using outlook object library for opening the PST files ,finding items within it.The Code works fine for normal PST files.but the code is failing for password protected PST files.I am getting the following error messagge in COMException object "Outlook failed to add the personal store to this session" with error code -2147467259. I am using following code for password protected files.

                    if (Process.GetProcessesByName("OUTLOOK").Length> 0)
                    {   
                        p_objOutlookApplication = (Outlook.Application) Marshal.GetActiveObject("Outlook.Application") as                                     Outlook.Application;
                    }
                    else
                    {
                        p_objOutlookApplication = new Outlook.Application();
                    }
                    f_objOutlookNameSpace = p_objOutlookApplication.GetNamespace("MAPI"); 

                    CurrentProfileName = m_objOutlookNameSpace.GetType().InvokeMember("CurrentProfileName",                                         System.Reflection.BindingFlags.GetProperty, null, m_objOutlookNameSpace, null);

                     if (!String.IsNullOrEmpty(CurrentProfileName.ToString()))
                         m_objOutlookNameSpace.Logon(CurrentProfileName.ToString(), "PASSWORD", true, true);

    and after this i am adding PST file to store with following code 

      m_objOutlookNameSpace.AddStore(m_strCurrentInputFilePath);

    Please Advice,

    Thanks..

    **Hemant


    H.S.Navarkar

    Wednesday, February 26, 2014 8:14 AM

Answers

  • Outlook Object Model does not let you explicitly specify a password when adding a store.

    You can use Extended MAPI (C++ or Delphi only) and set the PR_PST_PW_SZ_NEW_A property when configuring the PST store.

    Or you can use Redemption (any language) - it lets you specify the password when calling RDOSession.LogonPstStore or RDOSession.Stores.AddPstStoreWithPassword.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!





    Wednesday, February 26, 2014 1:54 PM

All replies