Export an email profile to PST

Status
Not open for further replies.
J

John L.

We are using Microsoft Outlook in cached exchange mode. The email profiles

are using OST files.

Is there a way to export an email profile (email, contacts, tasks, schedules

etc.) using VBA code?

Thank you for the help.
 
K

Ken Slovak - [MVP - Outlook]

You can copy the folders and items in the mailbox OST to a PST file, but

that won't include the profile information such as email accounts. Many

things in Outlook are stored in hidden items, which you won't be able to

copy in many cases, so things like global custom views probably won't make

it over.

Exactly what are you trying to accomplish? Have you considered looking for

commercial backup programs for Outlook?

"John L." <JohnL> wrote in message

news:F760178E-76D0-415D-800E-CE17F611EFCF@microsoft.com...
> We are using Microsoft Outlook in cached exchange mode. The email
> profiles
> are using OST files.

> Is there a way to export an email profile (email, contacts, tasks,
> schedules
> etc.) using VBA code?

> Thank you for the help.
>
 
J

John L.

Hi Ken,

Thank you for the info. We'd like to specifically obtain a backup of the

email (most importantly by far is the email in the inbox, deleted items, sent

items etc.) and calendar information if possible (tasks appointments etc.).

Is there a way to do this with VBA even though we are using Cached Exchange

Mode. We'd like to see a VBA code example that can run from a sub proc that

would export this.

We would rather not consider commercial solutions until we are sure that

this cannot be done with VBA. Auto Archive does not meet needs to make a

long story short. Thanks Ken.

John.
wrote:


> You can copy the folders and items in the mailbox OST to a PST file, but
> that won't include the profile information such as email accounts. Many
> things in Outlook are stored in hidden items, which you won't be able to
> copy in many cases, so things like global custom views probably won't make
> it over.

> Exactly what are you trying to accomplish? Have you considered looking for
> commercial backup programs for Outlook?

> >

>

> "John L." <JohnL> wrote in message
> news:F760178E-76D0-415D-800E-CE17F611EFCF@microsoft.com...
> > We are using Microsoft Outlook in cached exchange mode. The email
> > profiles
> > are using OST files.
> > Is there a way to export an email profile (email, contacts, tasks,
> > schedules
> > etc.) using VBA code?
> > Thank you for the help.
> >


>
 
K

Ken Slovak - [MVP - Outlook]

Well, Deleted Items holds trash, if your users keep items there that should

be retained they need some education in how to use Outlook.

Copying items to a PST file will change various properties on the items,

you'll have to accept that. It will also make backup more difficult since

each machine would need to be backed up as PST files are not supported for

storage on network shares or devices.

The basic idea would be to use the AddStore() method to add or create a new

PST file. Then you'd find the Inbox folder for both stores (creating it as

needed) and get each item in the folder and copy it to the new store. When

finished you can remove the store (PST file), although it will remain locked

by Outlook until Outlook is closed.

The code for Inbox would look something like this:

Sub BackupInbox()

Dim oBackup As Outlook.MAPIFolder

Dim oInbox As Outlook.MAPIFolder

Dim oBackInbox As Outlook.MAPIFolder

Dim oNS As Outlook.NameSpace

Dim colInboxItems As Outlook.Items

Dim colBackupInboxItems As Outlook.Items

Dim obj As Object 'Inbox items can be various types

Dim oCopy As Object

Set oNS = Application.GetNameSpace("MAPI")

Set oInbox = oNS.GetDefaultFolder(olFolderInbox)

Set oBackup = oNS.AddStore("C:\Backup.PST") 'whatever path

Set oBackInbox = Nothing

Set oBackInbox = oBackup.Folders("Inbox")

If oBackInbox Is Nothing Then

Set oBackInbox = oBackup.Folders.Add("Inbox", olFolderInbox)

End If

Set colInboxItems = oInbox.Items

Set colBackupInboxItems = oBackInbox.Items

For Each obj In colInboxItems

' get the item type here and make the new item the same as the old

one.

' needs a long series of if then tests not shown here

' example shows just a mail item

Set oCopy = colBackupInboxItems.Add(olNoteItem)

Next

End Sub

That doesn't have error handling or releasing objects, but it shows the type

of code needed for what you want.

"John L." <JohnL> wrote in message

news:CD71DDE4-F57A-400F-8DBA-AF41E000EE85@microsoft.com...
> Hi Ken,

> Thank you for the info. We'd like to specifically obtain a backup of the
> email (most importantly by far is the email in the inbox, deleted items,
> sent
> items etc.) and calendar information if possible (tasks appointments
> etc.).
> Is there a way to do this with VBA even though we are using Cached
> Exchange
> Mode. We'd like to see a VBA code example that can run from a sub proc
> that
> would export this.

> We would rather not consider commercial solutions until we are sure that
> this cannot be done with VBA. Auto Archive does not meet needs to make a
> long story short. Thanks Ken.

> John.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R Outlook 2010 How do you export 2 email Accounts' 2010 Inbox Files to new computer (2019)? Using Outlook 0
S How to export urls from email to excel and check the status of the url ? Using Outlook 5
A How to export one email data to excel Using Outlook 1
B Macro To Create Rule To Export From Certain Folder Email Information in one workbook multiple sheets Outlook VBA and Custom Forms 0
J How can I EXPORT my email address bok? Using Outlook 1
U Export of Message Header / Unique ID to Excel Sheet When email is Outlook VBA and Custom Forms 1
R Export email from Outlook into Access... Outlook VBA and Custom Forms 3
Owl Export Outlook PDF Attachment as JPG? Outlook VBA and Custom Forms 4
K Disabling import/export button to restrict PST creation Using Outlook 3
K Export Folder to PST Outlook VBA and Custom Forms 2
O Export Outlook calendar appointments by filters and date range Outlook VBA and Custom Forms 1
M Export-Import .pst file problems Using Outlook 2
M How to export Voting Results with user names and their responses Outlook VBA and Custom Forms 13
J Export Zimbra to Outlook PST Using Outlook.com accounts in Outlook 1
C Export NSF Lotus Notes files in Outlook PST format? Using Outlook 1
C How to export Outlook data to csv? Using Outlook 0
T How to Export mailbox from Outlook 2019 to MBOX format? Using Outlook 1
M Auto-export mail to Excel Outlook VBA and Custom Forms 2
P How to export voting results using VBA? Outlook VBA and Custom Forms 2
R How To Repair OST File & Export OST File to Outlook PST ? Using Outlook 3
JohnViuf Export task list view settings to other pc Outlook VBA and Custom Forms 16
J Copy or Export Outlook Mail to Excel Outlook VBA and Custom Forms 6
N Export details to a excel spreadsheet using macros Using Outlook 0
avant-guvnor Export Calendar, Birthdays and Holidays Outlook VBA and Custom Forms 0
Diane Poremsky Export (Save) Outlook Contact photos Using Outlook 0
K Macro to search emails between two time slots on public folders with excel export Outlook VBA and Custom Forms 12
W macro to export outlook emails to excel Outlook VBA and Custom Forms 6
E Exchanger service export detection Exchange Server Administration 1
R Correct a wrong csv export file from WLM 2012 Using Outlook 0
Q Outlook 2016\365 export specific rules to import in another system Exchange Server Administration 1
H How to export *all* fields from Outlook Using Outlook 2
K Export Organizational Forms Library Exchange Server Administration 1
N Export Outlook custom forms fields to excel Outlook VBA and Custom Forms 1
E RSS export as OPML problem Using Outlook 4
A export free / busy from exchange Exchange Server Administration 0
C Export to excel missing items, but a larger total? BCM (Business Contact Manager) 6
M Outlook 2013/365 won't export 99% of my contacts to csv Using Outlook 2
T Outlook 2007 Export tasks to Excel Using Outlook 2
J Opening/Archiving/Import/Export PST files Using Outlook 4
H Select one of Contact-Mailadesses to Export > Excel or Winword Outlook VBA and Custom Forms 2
Sarge USMC Cannot import/export Outlook 13 Using Outlook 6
L Outlook 2007 Codes Export and Import Using Outlook 9
L Outlook 2007 Toolbar Export and Import Using Outlook 7
S Requried a VBA Code to export Calander details to excel... Outlook VBA and Custom Forms 4
Jennifer Murphy Can I export individual emails? Using Outlook 1
R Export Address Book VBA Using Outlook 0
W How to export additional fields in contacts Using Outlook 1
R Recover/export rules from a backup .PST Using Outlook 2
J Formatting Contacts to Export for iPhone Using Outlook 0
B No export way Using Outlook 4

Similar threads

Top