Solved

Automatic Backup of Outlook connected to Exchange Server

Posted on 2008-10-13
5
548 Views
Last Modified: 2012-05-05
We need to backup Outlook automatically, every day.

Here are the circumstances:
Outlook 2007
Connected over Internet to Exchange Server.

There isn't a  .pst file.  There's an .ost file. My understanding of the  .ost  file is that it isn't the same as a .pst.  I don't know if backing up a copy of the .ost will help when there's damage to Outlook information.

Unless this is otherwise, I would like to have a complete export of the mailbox to a  local  .pst done every night automatically.  I am unsure of the scriptability of Outlook 2007.

Is there any software that would reliably do this?  The host makes a backup of the Exchange Server every night, but they want too much $$$ to perform a recovery.  If we had a local copy, we wouldn't have to get into an argument with them should we need to restore.  WE just had an incident where messages disappeared, and the host blamed us, and the rep asked if we 'had any proof' that they were responsible for the missing files.  

Thanks.

Larry
0
Comment
Question by:computerlarry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 97

Assisted Solution

by:war1
war1 earned 50 total points
ID: 22703321
Hello computerlarry,

Backing up the OST file will back up what is on the Exchange.  You will need Exchange server and Outlook to open OST file.  For PST file, you only need Outlook to open the file. (You can convert OST file to PST file, but will involve some cost.)

Hope this helps!
war1
0
 
LVL 76

Expert Comment

by:David Lee
ID: 22703715
Hi, computerlarry.

Outlook is very scriptable and copying everything to a PST file is pretty simple.  Running it at night though is a bit of a problem.  Outlook has to be running under the account that owns the mailbox for a script to work.  That means everyone would have to leave their computer logged in at night for the backup to run.  The workstation could be locked, but it would have to stay logged in.  Another approach would be to schedule the backup to run during the day.  I can provide the script if you want to go this route.  The script will have to be added to each computer.
0
 

Author Comment

by:computerlarry
ID: 22814961
BlueDF - could I please have that script?

Thanks.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 450 total points
ID: 22820292
Sure.  Here it is.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on Module1
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comments wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Select Macro Security
10.  Ensure the security setting is one of the bottom two options
11.  Close Outlook
12.  Start Outlook

Run the macro whenever you want to backup the mailbox.
Sub BackupMailboxToPSTFile()
    'Change the path on the following line to your path
    Const BACKUP_PATH = "C:\eeTesting\Backups\"
    Dim strBackupFileName As String, _
        objFSO As Object, _
        olkRootFolder As Outlook.MAPIFolder, _
        olkFolder As Outlook.MAPIFolder, _
        olkFolderCopy As Outlook.MAPIFolder, _
        olkBackup As Outlook.MAPIFolder
    strBackupFileName = "BU " & Format(Time, "hhmm") & "_" & Format(Date, "dd mmm yyyy") & ".pst"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(BACKUP_PATH & strBackupFileName) Then
        MsgBox "The mailbox was already backed up within the last minute.", vbInformation + vbOKOnly, "Folder BackUp"
    Else
        Session.AddStore BACKUP_PATH & strBackupFileName
        Set olkBackup = OpenOutlookFolder("Personal Folders")
        olkBackup.Name = strBackupFileName
        Session.RemoveStore olkBackup
        Session.AddStore BACKUP_PATH & strBackupFileName
        Set olkBackup = OpenOutlookFolder(strBackupFileName)
        Set olkRootFolder = Session.GetDefaultFolder(olFolderInbox).Parent
        For Each olkFolder In olkRootFolder.Folders
            Set olkFolderCopy = olkFolder.CopyTo(olkBackup)
        Next
        Session.RemoveStore olkBackup
    End If
    Set objFSO = Nothing
    Set olkBackup = Nothing
    Set olkRootFolder = Nothing
    Set olkFolder = Nothing
    Set olkFolderCopy = Nothing
    MsgBox "Backup complete.", vbInformation + vbOKOnly, "Backup Mailbox to PST"
End Sub
 
Function IsNothing(obj)
  If TypeName(obj) = "Nothing" Then
    IsNothing = True
  Else
    IsNothing = False
  End If
End Function
 
Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        olkFolder As Outlook.MAPIFolder
    On Error GoTo ehOpenOutlookFolder
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        If Left(strFolderPath, 1) = "\" Then
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        End If
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            If IsNothing(olkFolder) Then
                Set olkFolder = Session.Folders(varFolder)
            Else
                Set olkFolder = olkFolder.Folders(varFolder)
            End If
        Next
        Set OpenOutlookFolder = olkFolder
    End If
    On Error GoTo 0
    Exit Function
ehOpenOutlookFolder:
    Set OpenOutlookFolder = Nothing
    On Error GoTo 0
End Function

Open in new window

0
 

Expert Comment

by:VicManuel
ID: 24175693
As would be code to copy all the *. pst? incremental *.pst
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question