none
How do I backup a Personal Folders PST file?

    Question

  • Hi

    I'm trying to find a solution for my employer to automatically backup staff personal folders. I downloaded and installed the Microsoft Outlook Personal Folders Backup Add-in, however it doesn't appear to load in Outlook and I can't find where it installed either (I'm using Outlook 2007 on Win7 Enterprise). I was really after a more customised solution to copy the backup over the network, so I set about writing my own Outlook addin.

    However, I'm not able to copy the PST file as Outlook has it locked. A call to FileCopyEx results in the error "The process cannot access the file because another process has locked a portion of the file". This is understandable, however I don't know how to momentarily detach the PST file while I perform the copy. I tried the following:

    olApp.Session.RemoveStore(store.GetRootFolder());
    
    

    Which successfully closes the Personal Folders folder, but it still maintains a lock on the PST file. Manually closing the folder results int the same. Is what I'm attempting even possible? I assumed it was because the Microsoft addin mentioned above must to a similr thing (though I admit I've never seen it work). Perhaps there is an API other than the Outlook object model that might help me?

    Thanks and Regards, Andrew


    • Edited by Andrew Polden Thursday, September 29, 2011 7:02 AM more information
    Thursday, September 29, 2011 7:00 AM

Answers

  • Thanks Ken

    I had a quick look at Extended MAPI, and while a steep learning curve doesn't put me off, I think it makes this little project a bit more complicated than it needs to be. For now I'll write the app to run whilst Outlook is closed, and perhaps look at using Volume Shadow Copy Service to copy the PST if necessary.

    Regards, Andrew

    • Proposed as answer by Bruce Song Wednesday, October 12, 2011 7:03 AM
    • Marked as answer by Andrew Polden Wednesday, October 12, 2011 10:58 AM
    Monday, October 10, 2011 10:22 PM

All replies

  • Outlook locks a store folder such as a PST file until after Outlook is shut down. I'm not sure the timing is still the same, but it used to be for 10 minutes.
     
    You'd have to do something like using Extended MAPI, the Outlook object model won't help unless you want to back up things one item or folder at a time. Extended MAPI can only be programmed using C++ or Delphi/Pascal, and it has a steep learning curve.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Andrew Polden" <=?utf-8?B?QW5kcmV3IFBvbGRlbg==?=> wrote in message news:07f96c3c-3f1a-48f9-80f4-be48658da7a5...

    Hi

    I'm trying to find a solution for my employer to automatically backup staff personal folders. I downloaded and installed the Microsoft Outlook Personal Folders Backup Add-in, however it doesn't appear to load in Outlook and I can't find where it installed either (I'm using Outlook 2007 on Win7 Enterprise). I was really after a more customised solution to copy the backup over the network, so I set about writing my own Outlook addin.

    However, I'm not able to copy the PST file as Outlook has it locked. A call to FileCopyEx results in the error "The process cannot access the file because another process has locked a portion of the file". This is understandable, however I don't know how to momentarily detach the PST file while I perform the copy. I tried the following:

    olApp.Session.RemoveStore(store.GetRootFolder());
    
    

    Which successfully closes the Personal Folders folder, but it still maintains a lock on the PST file. Manually closing the folder results int the same. Is what I'm attempting even possible? I assumed it was because the Microsoft addin mentioned above must to a similr thing (though I admit I've never seen it work). Perhaps there is an API other than the Outlook object model that might help me?

    Thanks and Regards, Andrew



    Ken Slovak MVP - Outlook
    Thursday, September 29, 2011 2:21 PM
  • Hi Andrew,

    How about the problem on your side? Have you figured out your problem? If  you still show any concern on the thread, just feel free to let us know.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 10, 2011 1:57 AM
  • Thanks Ken

    I had a quick look at Extended MAPI, and while a steep learning curve doesn't put me off, I think it makes this little project a bit more complicated than it needs to be. For now I'll write the app to run whilst Outlook is closed, and perhaps look at using Volume Shadow Copy Service to copy the PST if necessary.

    Regards, Andrew

    • Proposed as answer by Bruce Song Wednesday, October 12, 2011 7:03 AM
    • Marked as answer by Andrew Polden Wednesday, October 12, 2011 10:58 AM
    Monday, October 10, 2011 10:22 PM