Jump to content

Outlook UDF


Wooltown
 Share

Recommended Posts

Wooltown,

I just downloaded the UDF and had some problems just getting started. I looked at the _OutlookSendMail demo and code snippets in this thread and whittled down my code to just this:

#Include "Outlook.au3"
$oOutlook = _OutlookOpen()

I got this error from it:

C:\Program Files\AutoIt3\Include\Outlook.au3(1685,3) : ERROR: syntax error

EndIf

^

C:\Program Files\AutoIt3\Include\Outlook.au3(1863,19) : ERROR: 'With' cannot be nested

With $oContact

~~~~~~~~~~~~~~~~~~^

What I found is in the Outlook.au3 file, line 1684 was commented out.

1683 EndIf

1684 ;Endwith

1685 EndIf

I took out the comment line and it seems to work.

All With ... EndWith should be removed, I will look into it !

Link to comment
Share on other sites

All With...EndWith removed !

Hey Wooltown, nice UDF, and coming in very handy at the moment.

Spotted a problem with _OutlookGetMail. If an email has an inline attachment (ie: an image embedded into the body, rather than shown with a paper clip), then the mail array doesn't get fully filled out,ie all of the properties after body in the array are blank.

I don't have a full solution, but you need to check the CID of the attachment, and if the CID is not blank, then the attachment is embedded and you can't assign the body to a string value.

See http://www.outlookcode.com/codedetail.aspx?id=52 (Joost's post) and http://www.eggheadcafe.com/software/aspnet/31644100/for-embedded-attachments.aspx for discussions about differentiating between embedded and non embedded attachments.

Nice work.

D

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

I need some help, I try to improve _OutlookCreateAppointment see here : http://www.autoitscript.com/forum/index.php?showtopic=108957

I have create a _OutlookDeleteAppointment:

;===============================================================================
;
; Function Name:    _OutlookDeleteAppointment()
; Description:  Modify an appointment using Microsoft Outlook.
; Syntax.........: _OutlookDeleteAppointment($oOutlook, $sSubject, $sStartDate, $sNewSubject = "", $sNewStartDate = "", $sEndDate = "", $sLocation = "", $fAllDayEvent = False, $sBody = "", $sReminder = 15, $sShowTimeAs = "", $iImportance = "", $iSensitivity = "", $iRecurrenceType = "", $sPatternStartDate = "", $sPatternEndDate = "", $iInterval = "", $iDayOfWeekMask = "", $iDay_MonthOfMonth_Year = "", $iInstance = "")
; Parameter(s):                 $oOutlook               - Outlook object opened by a preceding call to _OutlookOpen().
;                   $sSubject               - The Subject of the Appointment.
;                   $sStartDate         - Start date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                   $sNewSubject            - Optional: New Subject of the Appointment.
;                   $sNewStartDate          - Optional: New start date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                   $sEndDate               - Optional: End date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                                           Number of minutes. 
;                   $sLocation              - Optional: The location where the meeting is going to take place.
;                   $fAllDayEvent           - Optional: True or False if set to True and the appointment is lasting for more than one day, end Date
;                                            must be one day higher than the actual end Date.
;               $sBody              - Optional: The Body of the Appointment.
;                   $sReminder              - Optional: Reminder in Minutes before start, 0 for no reminder
;                   $sShowTimeAs            - Optional: $olBusy=2, $olFree=0, $olOutOfOffice=3, $olTentative=1
;                   $iImportance            - Optional: $olImportanceNormal=1, $olImportanceHigh=2, $olImportanceLow=0
;                   $iSensitivity           - Optional: $olNormal=0, $olPersonal=1, $olPrivate=2, $olConfidential=3
;                   $iRecurrenceType            - Optional: $olRecursDaily=0, $olRecursWeekly=1, $olRecursMonthly=2, $olRecursMonthNth=3, $olRecursYearly=5, $olRecursYearNth=6. Remove Recurrence=-1
;                   $sPatternStartDate      - Optional: Start Date of the Reccurent Appointment, format YYYY-MM-DD - or what is set locally.
;                   $sPatternEndDate            - Optional: End Date of the Reccurent Appointment, format YYYY-MM-DD - or what is set locally.
;                   $iInterval              - Optional: Interval between the Reccurent Appointment
;                   $iDayOfWeekMask         - Optional: Add the values of the days the appointment shall occur. $olSunday=1, $olMonday=2, $olTuesday=4, $olWednesday=8, $olThursday=16, $olFriday=32, $olSaturday=64
;                   $iDay_MonthOfMonth_Year - Optional: DayOfMonth or MonthOfYear, Day of the month or month of the year on which the recurring appointment or task occurs
;                   $iInstance              - Optional: This property is only valid for recurrences of the $olRecursMonthNth and $olRecursYearNth type and allows the definition of a recurrence pattern that is only valid for the Nth occurrence, such as "the 2nd Sunday in March" pattern. The count is set numerically: 1 for the first, 2 for the second, and so on through 5 for the last. Values greater than 5 will generate errors when the pattern is saved. 
; Requirement(s): AutoIt3 with COM support (post 3.1.1)
; Return Value(s):  On Success  - Returns 1
;   On Failure  - Returns 0 and sets @ERROR > 0
;                   @ERROR = 1      - Illegal parameters 
;                   @ERROR = 2      - Appointment not found
;                   @ERROR = 9      - ObjEvent error.
; Author(s):    Wooltown
; Created:  2009-02-23  
; Modified:     -
;
;===============================================================================
Func _OutlookDeleteAppointment($oOutlook, $sSubject, $sStartDate = "", $sEndDate = "", $sLocation = "", $fAllDayEvent = "", $sBody = "", $sReminder = "", $sShowTimeAs = "", $iImportance = "", $iSensitivity = "", $iRecurrenceType = "", $sPatternStartDate = "", $sPatternEndDate = "", $iInterval = "", $iDayOfWeekMask = "", $iDay_MonthOfMonth_Year = "", $iInstance = "")
    Local $iRc = 0, $fItemFound = False, $fIsRecurring, $oRecPatt, $oOrig
    Local $oOuError = ObjEvent("AutoIt.Error", "_OutlookError")
    Local $oNamespace = $oOutlook.GetNamespace("MAPI")
    Local $oFolder = $oNamespace.GetDefaultFolder($olFolderCalendar)
    Local $oColItems = $oFolder.Items
    $oColItems.Sort("[Start]")
    $oColItems.IncludeRecurrences = True 
    Local $sFilter = '[Subject] = "' & $sSubject & '"'
    Local $oFilteredItems = $oColItems.Restrict($sFilter)
    For $oItem In $oFilteredItems
        $fItemFound = True
        $fIsRecurring = $oItem.IsRecurring
        If $fIsRecurring = False Then
            $oItem.Delete
            $oItem.Close 
            $iRc = @ERROR
            If $iRc = 0 Or $iRc = -2147352561 Then
                Return 1
            Else
                Return SetError(9, 0, 0)
            EndIf
        Else                                                        ; ----- Recurring Appointment, change all occurences
            $oItem.GetFirst
            $oRecPatt = $oItem.GetRecurrencePattern
            ;With $oRecPatt
                If $sNewStartDate <> "" Then 
                    If Not _DateIsValid($sNewStartDate) Then Return SetError(1, 0, 0)
                $oRecPatt.StartTime = $sNewStartDate
            EndIf
                If $sEndDate <> "" Then 
                    If _DateIsValid($sEndDate) Then
                    $oRecPatt.EndTime = $sEndDate
                    Else
                        $oRecPatt.Duration = Number($sEndDate)
                    EndIf
                EndIf
                $oRecPatt.Save
                $oRecPatt.Close 
            ;Endwith
            $oOrig = $oRecPatt.Parent
            $oOrig.Delete
            $oOrig.Close 
            $iRc = @ERROR
            If $iRc = 0 Or $iRc = -2147352561 Then
                Return 1
            Else
                Return SetError(9, 0, 0)
            EndIf
        EndIf
    Next
    If $fItemFound = False Then Return SetError(2, 0, 0)
EndFunc

Thx in Advance

Outlook.au3

Link to comment
Share on other sites

Wooltown, thank you so much for creating this top UDF set - it has proved invaluable in making the switch from work diary appointments on an ageing Psion Series 7 to my shiny new netbook running Outlook.

Just one thing that did confuse me for some time until today was that in the "_Read_Outlook_Appointments()" function, start date and end dates do not work correctly unless date setting is set to USA (Sweden too?) format from Regional and Language options in control panel.

Great work and thanks again.

Rod

Link to comment
Share on other sites

Excellent work !

But I still don't understand how to list mails from a subfolder, itself into a 3rd or 4th account.

I've seen some code, but hard to get it working..

Do you plan to update the UDF soon ?

(BTW, could you replace all those "V:\Source Code\Outlook\Outlook.au3" with "Outlook.au3" please ? Thx :D )

Apzo.

Link to comment
Share on other sites

rodcrux:

Just one thing that did confuse me for some time until today was that in the "_Read_Outlook_Appointments()" function, start date and end dates do not work correctly unless date setting is set to USA (Sweden too?) format from Regional and Language options in control panel.

; Function Name: _OutlookGetAppointments()

; Description: Get the appointments in Microsoft Outlook specify Subject and or Date Interval

; Syntax.........: _OutlookGetAppointments($oOutlook, $sSubject = "", $sStartDate = "", $sEndDate = "", $sLocation = "", $iAllDayEvent = 2, $iImportance = "")

; Parameter(s): $oOutlook - Outlook object opened by a preceding call to _OutlookOpen().

; $sSubject - The Subject of the Appointment.

; $sStartDate - Start date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.

; $sEndDate - Optional: End date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.

I haven't tested it in other regional settings then here in sweden, but it should work with your regional setting.

Apzo:

But I still don't understand how to list mails from a subfolder, itself into a 3rd or 4th account.

I've seen some code, but hard to get it working..

This lists all mail in the LLLL folder on the same level as "Inbox"

$xx = _OutlookGetMail($oOutlook,"\LLLL" ,True,"","","","","","",False,"OutlookWarning2.exe",3)

This lists all mail in the subfolder "To Save" in Inbox

$xx = _OutlookGetMail($oOutlook,$olFolderInbox & "\To Save",False,"","","","","","",False,"OutlookWarning2.exe")

Link to comment
Share on other sites

Apzo:

This lists all mail in the LLLL folder on the same level as "Inbox"

$xx = _OutlookGetMail($oOutlook,"\LLLL" ,True,"","","","","","",False,"OutlookWarning2.exe",3)

This lists all mail in the subfolder "To Save" in Inbox

$xx = _OutlookGetMail($oOutlook,$olFolderInbox & "\To Save",False,"","","","","","",False,"OutlookWarning2.exe")

Hmmm, heaven is just next door :D

How do I get the $olFolderInbox value ?

(3 accounts, dozens of subfolders, the folder I'd like to list is in the 3rd account. That is : 3rd Inbox).

Apzo.

Link to comment
Share on other sites

Hmmm, heaven is just next door :D

How do I get the $olFolderInbox value ?

(3 accounts, dozens of subfolders, the folder I'd like to list is in the 3rd account. That is : 3rd Inbox).

Apzo.

The $olFolderInbox value is a numerial value, which is found on MSDN, is as a constant in the UDF, reading other persons folder is something I haven't mad yet, but somewhere in this topic comeno has made a solution for it.

Link to comment
Share on other sites

  • 2 weeks later...

Hello, Wooltown

Thank you for nice idea. I need in this UDF. Now I check func _OutlookGetContacts. You loss three strings.

If $fFullList = False Then 
   $asContacts[$asContacts[0][0]][0] = $oColItems.Item($iNum).FirstName
   $asContacts[$asContacts[0][0]][1] = $oColItems.Item($iNum).LastName
   $asContacts[$asContacts[0][0]][2] = $oColItems.Item($iNum).Email1Address
   $asContacts[$asContacts[0][0]][3] = $oColItems.Item($iNum).Email2Address
   $asContacts[$asContacts[0][0]][4] = $oColItems.Item($iNum).MobileTelephoneNumber
Else
   $asContacts[$asContacts[0][0]][0] =
   $asContacts[$asContacts[0][0]][1] =
   $asContacts[$asContacts[0][0]][2] =
   $asContacts[$asContacts[0][0]][3] = $oColItems.Item($iNum).Title
   $asContacts[$asContacts[0][0]][4] = $oColItems.Item($iNum).MiddleName

Best regards

Link to comment
Share on other sites

  • 2 weeks later...

I have the need to search for the contacts of a company name, so I've added this, can it be included on the UDF as well?

A small change in the Function call:

($oOutlook, $sFirstName = "", $sLastName = "", $sEmail1Adress = "", $sCompanyName = "", $fSearchPart = False, $fFullList = False, $sWarningClick = "")

Then this was added in the read loop, just after "For $iNum = 1 to $iNumOfContacts"

If $sCompanyname <> "" Then
            If $fSearchPart = False Then
                If $sCompanyname <> $oColItems.Item($iNum).CompanyName Then ContinueLoop
            Else
                If StringInStr($oColItems.Item($iNum).CompanyName,$sCompanyName) = 0 Then ContinueLoop
            EndIf
        EndIf

I have to create a list of contacts read from the AD, and created on a speccific Contacts Folder. How can I add the contacts to a speccific PST folder?

The ideia is that I can fill our several company phones with the latest contacts (using Nokia manager and activesync)

[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Link to comment
Share on other sites

I have to create a list of contacts read from the AD, and created on a speccific Contacts Folder. How can I add

the contacts to a speccific PST folder?

The ideia is that I can fill our several company phones with the latest contacts (using Nokia manager and activesync)

It's my correction for reading of different contact folders:

Func _OutlookGetContacts($oOutlook, $sFirstName = "", $sLastName = "", $sEmail1Adress = "", _

$fSearchPart = False, $fFullList = False, $sWarningClick = "", $sFolder = "" )

...

...

Local $oFolder = $oNamespace.GetDefaultFolder($olFolderContacts)

If $sFolder <> "" Then

$oFolder = $oNamespace.GetDefaultFolder($sFolder)

endIf

...

...

EndFunc

Link to comment
Share on other sites

  • 2 weeks later...

You have done some amazing work here, Wooltown. Thanks for your efforts.

I just noticed something that I am not sure is a bug or just me not understanding something. The _OutlookCreateTask seems to return failure codes even if the task is created.

#include <Outlook.au3>
Local $OOutlook = _OutlookOpen()
Local $Test = _OutlookCreateTask($OOutlook, "this is an _OutlookCreateTask() test") 
MsgBox(16, "test", "@ERROR = " & @ERROR & " and $Test = " & $Test)  
; Task gets created in Outlook but 
; @ERROR = 9 and $Test = 0 both indicating failure
Edited by daddydave
Link to comment
Share on other sites

Here is a start of _OutlookDeleteAppointment() I'm sure lot of things can be improve...

;===============================================================================
;
; Function Name:    _OutlookDeleteAppointment()
; Description:  Delete an appointment using Microsoft Outlook.
; Syntax.........: _OutlookDeleteAppointment($oOutlook, $sSubject, $sStartDate, $sNewSubject = "", $sNewStartDate = "", $sEndDate = "", $sLocation = "", $fAllDayEvent = False, $sBody = "", $sReminder = 15, $sShowTimeAs = "", $iImportance = "", $iSensitivity = "", $iRecurrenceType = "", $sPatternStartDate = "", $sPatternEndDate = "", $iInterval = "", $iDayOfWeekMask = "", $iDay_MonthOfMonth_Year = "", $iInstance = "")
; Parameter(s):                 $oOutlook               - Outlook object opened by a preceding call to _OutlookOpen().
;                   $sSubject               - The Subject of the Appointment.
;                   $sStartDate         - Start date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                   $sNewSubject            - Optional: New Subject of the Appointment.
;                   $sNewStartDate          - Optional: New start date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                   $sEndDate               - Optional: End date & time of the Appointment, format YYYY-MM-DD HH:MM - or what is set locally.
;                                           Number of minutes. 
;                   $sLocation              - Optional: The location where the meeting is going to take place.
;                   $fAllDayEvent           - Optional: True or False if set to True and the appointment is lasting for more than one day, end Date
;                                            must be one day higher than the actual end Date.
;               $sBody              - Optional: The Body of the Appointment.
;                   $sReminder              - Optional: Reminder in Minutes before start, 0 for no reminder
;                   $sShowTimeAs            - Optional: $olBusy=2, $olFree=0, $olOutOfOffice=3, $olTentative=1
;                   $iImportance            - Optional: $olImportanceNormal=1, $olImportanceHigh=2, $olImportanceLow=0
;                   $iSensitivity           - Optional: $olNormal=0, $olPersonal=1, $olPrivate=2, $olConfidential=3
;                   $iRecurrenceType            - Optional: $olRecursDaily=0, $olRecursWeekly=1, $olRecursMonthly=2, $olRecursMonthNth=3, $olRecursYearly=5, $olRecursYearNth=6. Remove Recurrence=-1
;                   $sPatternStartDate      - Optional: Start Date of the Reccurent Appointment, format YYYY-MM-DD - or what is set locally.
;                   $sPatternEndDate            - Optional: End Date of the Reccurent Appointment, format YYYY-MM-DD - or what is set locally.
;                   $iInterval              - Optional: Interval between the Reccurent Appointment
;                   $iDayOfWeekMask         - Optional: Add the values of the days the appointment shall occur. $olSunday=1, $olMonday=2, $olTuesday=4, $olWednesday=8, $olThursday=16, $olFriday=32, $olSaturday=64
;                   $iDay_MonthOfMonth_Year - Optional: DayOfMonth or MonthOfYear, Day of the month or month of the year on which the recurring appointment or task occurs
;                   $iInstance              - Optional: This property is only valid for recurrences of the $olRecursMonthNth and $olRecursYearNth type and allows the definition of a recurrence pattern that is only valid for the Nth occurrence, such as "the 2nd Sunday in March" pattern. The count is set numerically: 1 for the first, 2 for the second, and so on through 5 for the last. Values greater than 5 will generate errors when the pattern is saved. 
; Requirement(s): AutoIt3 with COM support (post 3.1.1)
; Return Value(s):  On Success  - Returns 1
;   On Failure  - Returns 0 and sets @ERROR > 0
;                   @ERROR = 1      - Illegal parameters 
;                   @ERROR = 2      - Appointment not found
;                   @ERROR = 9      - ObjEvent error.
; Author(s):    Wooltown
; Created:  2009-02-23  
; Modified:     -
;
;===============================================================================
Func _OutlookDeleteAppointment($oOutlook, $sSubject, $sStartDate = "", $sEndDate = "", $sLocation = "", $fAllDayEvent = "", $sBody = "", $sReminder = "", $sShowTimeAs = "", $iImportance = "", $iSensitivity = "", $iRecurrenceType = "", $sPatternStartDate = "", $sPatternEndDate = "", $iInterval = "", $iDayOfWeekMask = "", $iDay_MonthOfMonth_Year = "", $iInstance = "")
    Local $iRc = 0, $fItemFound = False, $fIsRecurring, $oRecPatt, $oOrig
    Local $oOuError = ObjEvent("AutoIt.Error", "_OutlookError")
    Local $oNamespace = $oOutlook.GetNamespace("MAPI")
    Local $oFolder = $oNamespace.GetDefaultFolder($olFolderCalendar)
    Local $oColItems = $oFolder.Items
    $oColItems.Sort("[Start]")
    $oColItems.IncludeRecurrences = True 
    Local $sFilter = '[Subject] = "' & $sSubject & '"'
    Local $oFilteredItems = $oColItems.Restrict($sFilter)
    For $oItem In $oFilteredItems
        $fItemFound = True
        $fIsRecurring = $oItem.IsRecurring
        If $fIsRecurring = False Then
            $oItem.Delete
            $oItem.Close 
            $iRc = @ERROR
            If $iRc = 0 Or $iRc = -2147352561 Then
                Return 1
            Else
                Return SetError(9, 0, 0)
            EndIf
        Else                                                        ; ----- Recurring Appointment, change all occurences
            $oItem.GetFirst
            $oRecPatt = $oItem.GetRecurrencePattern
            ;With $oRecPatt
                If $sNewStartDate <> "" Then 
                    If Not _DateIsValid($sNewStartDate) Then Return SetError(1, 0, 0)
                $oRecPatt.StartTime = $sNewStartDate
            EndIf
                If $sEndDate <> "" Then 
                    If _DateIsValid($sEndDate) Then
                    $oRecPatt.EndTime = $sEndDate
                    Else
                        $oRecPatt.Duration = Number($sEndDate)
                    EndIf
                EndIf
                $oRecPatt.Save
                $oRecPatt.Close 
            ;Endwith
            $oOrig = $oRecPatt.Parent
            $oOrig.Delete
            $oOrig.Close 
            $iRc = @ERROR
            If $iRc = 0 Or $iRc = -2147352561 Then
                Return 1
            Else
                Return SetError(9, 0, 0)
            EndIf
        EndIf
    Next
    If $fItemFound = False Then Return SetError(2, 0, 0)
EndFunc

Enjoy ;~)

Edited by Syl21
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Hello, I find this UDF extremely useful I thank you so very much for releasing this to the community. I kinda found a bug in the _OutlookGetContacts Func.

The function does not show the first names when it is set True to return a full List:

Line# 2038
        If $fFullList = False Then 
            $asContacts[$asContacts[0][0]][0] = $oColItems.Item($iNum).FirstName
            $asContacts[$asContacts[0][0]][1] = $oColItems.Item($iNum).LastName
            $asContacts[$asContacts[0][0]][2] = $oColItems.Item($iNum).Email1Address
            $asContacts[$asContacts[0][0]][3] = $oColItems.Item($iNum).Email2Address
            $asContacts[$asContacts[0][0]][4] = $oColItems.Item($iNum).MobileTelephoneNumber
        Else
            $asContacts[$asContacts[0][0]][3] = $oColItems.Item($iNum).Title
            $asContacts[$asContacts[0][0]][4] = $oColItems.Item($iNum).MiddleName
            $asContacts[$asContacts[0][0]][5] = $oColItems.Item($iNum).Suffix
            $asContacts[$asContacts[0][0]][6] = $oColItems.Item($iNum).Email1DisplayName
            $asContacts[$asContacts[0][0]][7] = $oColItems.Item($iNum).Email2Address
            $asContacts[$asContacts[0][0]][8] = $oColItems.Item($iNum).Email2DisplayName
            $asContacts[$asContacts[0][0]][9] = $oColItems.Item($iNum).Email3Address
            $asContacts[$asContacts[0][0]][10] = $oColItems.Item($iNum).Email3DisplayName
            $asContacts[$asContacts[0][0]][11] = $oColItems.Item($iNum).JobTitle
            $asContacts[$asContacts[0][0]][12] = $oColItems.Item($iNum).CompanyName
            $asContacts[$asContacts[0][0]][13] = $oColItems.Item($iNum).Body
            $asContacts[$asContacts[0][0]][14] = $oColItems.Item($iNum).SelectedMailingAddress
            $asContacts[$asContacts[0][0]][15] = $oColItems.Item($iNum).Categories
            $asContacts[$asContacts[0][0]][16] = $oColItems.Item($iNum).MobileTelephoneNumber
            $asContacts[$asContacts[0][0]][17] = $oColItems.Item($iNum).HomeTelephoneNumber
            $asContacts[$asContacts[0][0]][18] = $oColItems.Item($iNum).HomeAddressStreet
            $asContacts[$asContacts[0][0]][19] = $oColItems.Item($iNum).HomeAddressCity
            $asContacts[$asContacts[0][0]][20] = $oColItems.Item($iNum).HomeAddressState
            $asContacts[$asContacts[0][0]][21] = $oColItems.Item($iNum).HomeAddressPostalCode
            $asContacts[$asContacts[0][0]][22] = $oColItems.Item($iNum).HomeAddressCountry
            $asContacts[$asContacts[0][0]][23] = $oColItems.Item($iNum).BusinessTelephoneNumber
            $asContacts[$asContacts[0][0]][24] = $oColItems.Item($iNum).BusinessAddressStreet
            $asContacts[$asContacts[0][0]][25] = $oColItems.Item($iNum).BusinessAddressCity
            $asContacts[$asContacts[0][0]][26] = $oColItems.Item($iNum).BusinessAddressState
            $asContacts[$asContacts[0][0]][27] = $oColItems.Item($iNum).BusinessAddressPostalCode
            $asContacts[$asContacts[0][0]][28] = $oColItems.Item($iNum).BusinessAddressCountry
            $asContacts[$asContacts[0][0]][29] = $oColItems.Item($iNum).OtherTelephoneNumber
            $asContacts[$asContacts[0][0]][30] = $oColItems.Item($iNum).OtherAddressStreet
            $asContacts[$asContacts[0][0]][31] = $oColItems.Item($iNum).OtherAddressCity
            $asContacts[$asContacts[0][0]][32] = $oColItems.Item($iNum).OtherAddressState
            $asContacts[$asContacts[0][0]][33] = $oColItems.Item($iNum).OtherAddressPostalCode
            $asContacts[$asContacts[0][0]][34] = $oColItems.Item($iNum).OtherAddressCountry
            $asContacts[$asContacts[0][0]][35] = $oColItems.Item($iNum).WebPage
            $asContacts[$asContacts[0][0]][36] = $oColItems.Item($iNum).IMaddress
            $asContacts[$asContacts[0][0]][37] = $oColItems.Item($iNum).Birthday
            $asContacts[$asContacts[0][0]][38] = $oColItems.Item($iNum).Department
            $asContacts[$asContacts[0][0]][39] = $oColItems.Item($iNum).OfficeLocation
            $asContacts[$asContacts[0][0]][40] = $oColItems.Item($iNum).Profession
            $asContacts[$asContacts[0][0]][41] = $oColItems.Item($iNum).ManagerName
            $asContacts[$asContacts[0][0]][42] = $oColItems.Item($iNum).AssistantName
            $asContacts[$asContacts[0][0]][43] = $oColItems.Item($iNum).NickName
            $asContacts[$asContacts[0][0]][44] = $oColItems.Item($iNum).Spouse
            $asContacts[$asContacts[0][0]][45] = $oColItems.Item($iNum).Anniversary
        EndIf

Why?

If set to False it does the first 5 items but if set to True it jumps to the rest above the third item so the name ends up as an empty value!

Also, after fixing this, when using the full list option the order seems messy.

FirstName, LastName, Email1Address, Title, MiddleName, Suffix, Email1DisplayName

I fixed my copy of the UDF to fit my needs (first and last name and the 3 mail adresses together if available).

I want to thank you again for this wonderful UDF. It's great, Wooltown! :idea:

AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

Link to comment
Share on other sites

  • 5 weeks later...

For my application-in-progress (and I would think many applications would benefit from this), I ended up changing _OutlookOpen() so that it tries to get an existing instance of Outlook (ObjGet) and return that one and creating a new one (ObjCreate) only if that fails. I only halfway know what I'm doing though, so I am afraid to post the working code until I've used it a while. :idea: But it's trivial, and anyone should be able to figure it out from the ObjGet documentation.

Edited by daddydave
Link to comment
Share on other sites

  • 1 month later...

This UDF saved me a lot of work! Thanks for the time and effort you put in to this. Only thing that I'm missing is a send with delay function.

I know this isn't a populair function, but it's really usefull. You can find it when you set up a new e-mail at options. Then you see an option "Don't deliver before..." (I translated this from Dutch, so it can be slightly different).

Do you think this will be added somewhere in the future? I would really love to see it. If not, thanks anyway for this UDF :blink:

Link to comment
Share on other sites

  • 2 weeks later...

Hello!

First of all, very nice UDF! :blink:

I'm trying to read/save emails from a 'shared mailbox'.

I've tryed IQ9003's solution in page 4, but didn't worked... :/

My code:

#Include <Array.au3>
#Include <Outlook.au3>
$oOutlook = _OutlookOpen()
$Folders = _OutlookGetMail($oOutlook, "\\Caixa de correios - Cadastro Credito - VC\Inbox")
_ArrayDisplay($Folders, "Inbox")

post-54119-12790481691569_thumb.jpg

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