Backup Calendar, Contacts, Tasks in an POP3 data file

Status
Not open for further replies.
if they are in a pst file, all you need to do is copy the pst (with outlook closed).

If you wanted to use it to export just those folders, you only need to remove the lines that change the folder type as the pst will have the correct folder types. But even then, it won't hurt to leave it in.

Those would be all of the lines that reference the propertyaccessor -
Code:
Dim oPA As Outlook.PropertyAccessor
Dim PropName, Value As String
PropName = "http://schemas.microsoft.com/mapi/proptag/0x3613001E"
Set oPA = myBackup.PropertyAccessor
oPA.SetProperty PropName, Value
 
Last edited:
Hello Diane,
Thank you for your reply.
Pardon my ignorance, but would you like to write down the entire macro for PST ?
 
if you just want to back up the pst, I have this - Use PowerShell to backup Outlook PST files


But if you want to export the calendar & contacts, and tasks.


Code:
Sub CreateBackupFiles()
 
Dim OlApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim copyToDataFile As Outlook.folder
Dim copyFrom As Outlook.folder
Dim myBackup As Outlook.folder
Dim objFolder As Outlook.folder
Dim folderType
Dim enviro As String, strDate As String
Dim strFileName As String, pstName As String

Set objNS = Application.GetNamespace("MAPI")
 
enviro = CStr(Environ("USERPROFILE"))
strDate = Format(Date, "yyyymmdd") & Format(Time, "hhmmss")
strFileName = enviro & "\Documents\Outlook Files\" & strDate & "-BackUp" & ".pst"
pstName = "Backup " & strDate
 
Debug.Print strFileName
 
' Create the backup pst file
objNS.AddStore strFileName
Set objFolder = objNS.Folders.GetLast
objFolder.Name = pstName
 
Set copyToDataFile = objFolder
 
For i = 1 To 4
Select Case i
    Case 1
     folderType = olFolderCalendar
     Value = "IPF.Appointment"

    Case 2
     folderType = olFolderContacts
     Value = "IPF.Contact"

    Case 3
     folderType = olFolderTasks
     Value = "IPF.Task"

    Case 4
     folderType = olFolderNotes
     Value = "IPF.StickyNote"

End Select
 
Set copyFrom = objNS.GetDefaultFolder(folderType)
Set myBackup = copyFrom.CopyTo(copyToDataFile)

 Next i
 
' remove the pst from the folder list
'objNS.RemoveStore objFolder
 
Set oPA = Nothing
Set objNS = Nothing
End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Is it possible to backup Outlook.com/Outlook 2013 Email & Calendar info? Using Outlook.com accounts in Outlook 3
M Synchronization and backup of Outlook from local to server. Using Outlook 11
Hornblower409 Automatically or Manually Backup Multiple Versions of VbaProject.OTM Outlook VBA and Custom Forms 1
L Recommendations for Utility to Backup Outlook 365 Account Settings Using Outlook 2
L Restoring Outlook from backup pst file Using Outlook 5
D a general question re how backup programs handle pst files ... I have no problems, just curious Using Outlook 1
V IMAP backup Using Outlook 0
A Backup Email Accounts On OutLook For Mac 2016 (Microsoft 365 subscription version) Using Outlook 0
L Restoring Outlook from backup of OST Using Outlook 5
T Need to backup outlook.com to cloud storage, without desktop software - Testing UpSafe. Are there any similar services? Using Outlook.com accounts in Outlook 8
V Scheduled backup of imap account Using Outlook 7
R How Can I backup office 365 account? Exchange Server Administration 1
C OST email backup Exchange Server Administration 1
O Backup Office settings - registry key Using Outlook 5
I Backup email account information Using Outlook 2
J Backup .OST - Custom Contact Forms, Defined Fields, Notes Using Outlook 1
S BCM Auto Backup Data and Customizations BCM (Business Contact Manager) 6
L Online 3rd party backup of Office 365 cloud Using Outlook 5
B changing Win7 default backup schedule for Previous Versions Using Outlook 0
Terradon which file/s to backup? Using Outlook 4
LeeDock Office 365 Personal Backup strategy Using Outlook 1
M Outlook Backup help needed ASAP Using Outlook 2
B Easy to handle backup tool Using Outlook 1
O Personal Folders Backup aftermath Using Outlook 5
D PST file backup Using Outlook 1
R Missing Backup command in File menu after installing pfback.exe Using Outlook 2
C Password for backup of Outlook Using Outlook 1
P Best way to locally backup/archive Gmail? Using Outlook 1
R Recover/export rules from a backup .PST Using Outlook 2
V Outlook Data File (PST) - Auto Backup Solution Using Outlook 3
B importing Outlook from a backup on an external hard drive Using Outlook 5
V Backup pst to NAS drive? Using Outlook 4
S Backup custom menus Using Outlook 3
T Using Outlook 2010 in Outlook2003 as backup ? Using Outlook 21
D Outlook 2010 .pst file backup Using Outlook 2
C can't backup OL 2007 (error message 0x80070021) + only done by administrator Using Outlook 1
R What to backup before removing Outlook 2010? Using Outlook 4
E Disappointed in Outlook 2007, backup, restore, synch Using Outlook 5
R How to backup contacts in Outlook 2010 as business cards Using Outlook 1
E Outlook 2007 backup and restore function Using Outlook 2
L Outlook backup tool Using Outlook 5
R Looking for my BCM backup files BCM (Business Contact Manager) 1
M Backup Outlook VBA and Custom Forms 2
M Backup Outlook Data File BCM (Business Contact Manager) 2
O transfer BCM SQL data without backup BCM (Business Contact Manager) 1
T What is contained in the backup of BCM BCM (Business Contact Manager) 2
S Scheduled backup for BCM Database Tool BCM (Business Contact Manager) 1
J Database Files to be Copied from Backup Image - No BCM Backup Data BCM (Business Contact Manager) 5
M Backup and restore E2K7 with Server2K8 Exchange Server Administration 4
Q Automate BCM backup? BCM (Business Contact Manager) 1

Similar threads

Back
Top