Jump to content

Outlook 2007 export script?


Recommended Posts

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?

Link to comment
Share on other sites

Did you check my OutlookEX UDF?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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?

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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")

Link to comment
Share on other sites

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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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!

Link to comment
Share on other sites

Glad to be of service :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...