Jump to content

Outlook EX UDF - Export to .csv using _OL_ItemExport()


Recommended Posts

Hi There,

Tried to use _OL_ItemExport function to get items from my calendar. It returns a .csv.

However, when I try to export the Body/Description it puts on a separate line even though it is the same item. The reason is because the Body of the Calendar item has <enter>. So one calender item is now showing as several lines in my .csv file.

How can I keep it on the same line or change the row delimiter? I could only find the field delimiter option for this function.

Here's my code snippet:

$aData= _OL_ItemFind($oOutlook, "*\Calendar", $olAppointment, "[start]>='"&$start&"'", "", "", "Subject,Start,End,Body", "", 2)

If @error <> 0 Then Exit MsgBox(16, "", "Error getting calendar from folder '*\Calendar'. @error = " & @error & ", @extended = " & @extended)

Global $iResult = _OL_ItemExport($filename, "~", "", 1, "Subject,Start,End,Body", $aData)

If @error <> 0 Then Exit MsgBox(16, "", "Error exporting Calendar to file. @error = " & @error & ", @extended = " & @extended)

MsgBox(64, "", $iResult & " Calendar successfully exported to file")

Thx in advance!!

Link to comment
Share on other sites

$aData= _OL_ItemFind($oOutlook, "*Calendar", $olAppointment, "[Start]>='"&$start&"'", "", "", "Subject,Start,End,Body", "", 2)
; ... here replace all @CRLF to "space" in column Body for all rows of array $aData ...
Global $iResult = _OL_ItemExport($filename, "~", "", 1, "Subject,Start,End,Body", $aData)

Edited by Zedna
Link to comment
Share on other sites

  • 11 months later...

I am trying to modify this sample script to extract subject to a csv file for emails in a specific folder. I have an automated process that sends 'fax emails', for lack of a better term, to a service that turns the emails into faxes and deals with that end of the process. A number of these 'faxes' bounce every day and I would like to examine our email history and determine if there is any pattern to the bounces by exporting the subject lines...

I have started with a sample script and am trying to adapt it to the purpose, but I am having some trouble.

#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include

; *****************************************************************************
; Create test environment
; *****************************************************************************
Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
;Global $Result = _OL_TestEnvironmentCreate($oOutlook)
;If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF - Manage Test Environment", "Error creating the test environment. @error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Example 1
; Export all contacts from the test folder to c:\temp\_OL_ItemExport.csv
; *****************************************************************************
;"[From]>='MetroFax'"
Global $aData = _OL_ItemFind($oOutlook, "*\TTL Reports Response", $olMail, "", "", "", "From,Subject")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemExport Example Script", "Error getting mail from folder '*\TTL Reports Response'. @error = " & @error & ", @extended = " & @extended)
Global $iResult = _OL_ItemExport("C:\temp\_OL_ItemExport.csv", "", "", 1, "Subject", $aData)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemExport Example Script", "Error exporting contacts to file 'C:\temp\_OL_ItemExport.csv'. @error = " & @error & ", @extended = " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_ItemExport Example Script", $iResult & " contact(s) successfully exported to file 'C:\temp\_OL_ItemExport.csv'.")

_OL_Close($oOutlook)

I get the following error when I run ...

post-76961-0-85213400-1365623085_thumb.j

Any assistance is appreciated...

And the sign said 'Long Hairded Creepy People Need Not Apply' ... So I stuffed my hair up under my hat and I went in to ask him why?

Link to comment
Share on other sites

@error = 1xx means: "Error checking $sReturnProperties as returned by __OL_CheckProperties."

Property "From" does not exist. It is either "SenderEmailAddress" or "SenderName"

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...