Help!

Export an email profile to PST

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  Invoice template problem  
Author Message
John L.
External


Since: Oct 18, 2006
Posts: 7



PostPosted: Thu Jul 09, 2009 11:06 am    Post subject: Export an email profile to PST
Archived from groups: microsoft>public>outlook>program_vba (more info?)

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.
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Thu Jul 09, 2009 6:38 pm    Post subject: Re: Export an email profile to PST [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"John L." <JohnL.TakeThisOut@discussions.microsoft.com> 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.
>
Back to top
John L.
External


Since: Oct 18, 2006
Posts: 7



PostPosted: Fri Jul 10, 2009 6:48 am    Post subject: Re: Export an email profile to PST [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

"Ken Slovak - [MVP - Outlook]" 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?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "John L." <JohnL.RemoveThis@discussions.microsoft.com> 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.
> >
>
>
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Mon Jul 13, 2009 9:34 am    Post subject: Re: Export an email profile to PST [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"John L." <JohnL.DeleteThis@discussions.microsoft.com> 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.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum