Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Automatic Backup of Outlook connected to Exchange Server

Posted on 2008-10-13
5
Medium Priority
?
571 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
5 Comments
 
LVL 97

Assisted Solution

by:war1
war1 earned 200 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 1800 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

916 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