Sign in to follow this  
Followers 0
DietCoke

Outlook 2007 export script?

10 posts in this topic

I need to export all mailbox items *other than email* from an Exchange mailbox into single purpose pst files (ex. calender.pst, contacts.pst, etc).  In looking through the Outlook.udf threads I'm not seeing anything specific to that.  Am I missing something or is this functionality not there?

Share this post


Link to post
Share on other sites



Did you check my OutlookEX UDF?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Did you check my OutlookEX UDF?

 

Yes, however it doesn't seem like _OL_ItemExport will output that data to pst.  Am I missing something?

Share this post


Link to post
Share on other sites

if you mean to export folders that contain items other than email messages, this is one thing. if you have folders that incorporate several items types, that's another thing. both tasks can be accomplished by water's OutlookEx UDF. which one is your task?

Share this post


Link to post
Share on other sites

Yes, however it doesn't seem like _OL_ItemExport will output that data to pst.  Am I missing something?

You do not need _OL_ItemExport, you need _OL_ItemCopy beacause you want to copy items to another store.

_OL_ItemCopy can write items to every folder you like.

Please have a look at the example script or search the forum for "_OL_ItemCopy archive"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

if you mean to export folders that contain items other than email messages, this is one thing. if you have folders that incorporate several items types, that's another thing. both tasks can be accomplished by water's OutlookEx UDF. which one is your task?

 

Thanks to both you and Water.  I'm actually looking to back up everything *but* mail if possible.  Critical items are contacts, notes & calender.  The goal is to make a local PST and backup the aforementioned items from the Exchange server to it.

I understand the differentiation between ItemExport and ItemCopy, but is there a constant for an Exchange mailbox?  Somewhere where I can just specify the folder I (example, this is definitely non-working code):

_OL_ItemCopy($oOutlook, $aOL_ItemContacts[1][0], Default, "C:Outlook-UDF-TestTargetFolderContacts")

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

to my understanding, _OL_ItemCopy() can handle only a single item (by the EntryID) and is not recursive. unless i'm 180 degrees off course, that means you need to first enumerate your folders with _OL_FolderTree(), then loop the folders, and for every folder that is not a mail store, loop all items and then for each item use _OL_ItemCopy().

later you can either repeat that on regular intervals (e.g. daily), or hook on an event to let you know when an item is added or modified.

unless water have some better method, i'll post a piece of code to demonstrate how i do it.

b.t.w to my experience, when it comes to contents, there is nothing specific to Exchange mailbox compared to local PST file.

Edited by orbs

Share this post


Link to post
Share on other sites

A bit easier would be to use _OL_ItemFind to search for contacts and set parameter $iFlags = 1 to search subfolders too (recursive search). Then use _OL_ItemCopy on each returned item to copy it to the PST. Repeat this for all other item classes.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks again to both of you!  I ended up spinning my wheels quite a bit, but Water, I found an example that you provided that I was able to easily retrofit (post #214):

I have retrofitted it below to back up the following items:

* Calender

* Contacts

* Journal

* Notes

* Tasks

* To-Do's

As stated previously, this does not back up any mail.

#include <OutlookEx.au3>
#include <array.au3>
$iOL_Debug = 2
$oOutlook = _OL_Open()
ConsoleWrite("OO: " & @error & "-" & @extended & @CRLF)
$oPST = _OL_PSTCreate($oOutlook, "C:\temp" & "\" & @YEAR & "-" & @MON & "-" & @MDAY & "-" & @UserName & ".pst", @YEAR & "-" & @MON & "-" & @MDAY & "-" & @UserName)
ConsoleWrite("PC: " & @error & "-" & @extended & @CRLF)
#cs
Global Const $olFolderCalendar = 9 ; Calendar folder
Global Const $olFolderContacts = 10 ; The Contacts folder
Global Const $olFolderDeletedItems = 3 ; The Deleted Items folder
Global Const $olFolderDrafts = 16 ; The Drafts folder
Global Const $olFolderInbox = 6 ; The Inbox folder
Global Const $olFolderJournal = 11 ; The Journal folder
Global Const $olFolderJunk = 23 ; The Junk E-Mail folder
Global Const $olFolderNotes = 12 ; The Notes folder
Global Const $olFolderOutbox = 4 ; The Outbox folder
Global Const $olFolderSentMail = 5 ; The Sent Mail folder
Global Const $olFolderTasks = 13 ; The Tasks folder
Global Const $olFolderToDo = 28 ; The To Do folder
Global Const $olFolderRssFeeds = 25 ; The RSS Feeds folder
#ce
$aFolder = _OL_FolderAccess($oOutlook, "" , $olFolderCalendar)
$bFolder = _OL_FolderAccess($oOutlook, "" , $olFolderContacts)
$cFolder = _OL_FolderAccess($oOutlook, "" , $olFolderJournal)
$dFolder = _OL_FolderAccess($oOutlook, "" , $olFolderNotes)
$eFolder = _OL_FolderAccess($oOutlook, "" , $olFolderTasks)
$fFolder = _OL_FolderAccess($oOutlook, "" , $olFolderToDo)
ConsoleWrite("FA: " & @error & "-" & @extended & @CRLF)
_OL_FolderCopy($oOutlook, $aFolder[1], $oPST)
_OL_FolderCopy($oOutlook, $bFolder[1], $oPST)
_OL_FolderCopy($oOutlook, $cFolder[1], $oPST)
_OL_FolderCopy($oOutlook, $dFolder[1], $oPST)
_OL_FolderCopy($oOutlook, $eFolder[1], $oPST)
_OL_FolderCopy($oOutlook, $fFolder[1], $oPST)
ConsoleWrite("FC: " & @error & "-" & @extended & @CRLF)
_OL_PSTClose($oOutlook, $oPST)
ConsoleWrite("PC: " & @error & "-" & @extended & @CRLF)
_OL_Close($oOutlook)
ConsoleWrite("OC: " & @error & "-" & @extended & @CRLF)
MsgBox(4096,"Titlebar info here.","Test export complete... ")

Thank you again!

Share this post


Link to post
Share on other sites

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0