Jump to content

OutlookEX UDF - Help & Support (IV)


Recommended Posts

Thank you water! That worked great as always.

It seems that _OL_ItemRecipientCheck doesn't work when passing an array of names to be resolved. There is a check to see if $sP1 is blank when stripped of whitespace before the check for an array. It looks like the check should be made 2 lines later than it is currently :) 

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites
  • Replies 492
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Fixed in version 1.3.3.1 of the UDF I uploaded today

I know I'm not Bill Murray, so I'm not a god  

As the OutlookEX UDF - Help & Support thread has grown too big, I'm starting a new one. The original thread can be found here.

Posted Images

I had a quick look and think it is a bug.
Will be fixed in the next version :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Hi, 

I am aiming to add a basic button to Outlook GUI, and now experimenting with OutlookEXGUI. 

My test script is listing attachments of currently selected e-mail: 

#include <OutlookEx.au3>
#include <OutlookEXGUI.au3>
#include <Array.au3>

$Outlook = _OL_Open()
$Email = _OL_FolderSelectionGet ( $Outlook )
$Attachments = _OL_ItemAttachmentGet ( $Outlook, $Email[1][1] )
_ArrayDisplay ( $Attachments )

_OL_BarGroupAdd ( $Outlook, "Test", 1 )
_OL_Close( $Outlook )

Attachment part works fine, but _OL_BarGroupAdd seem not change anything in the Outllok client (Office 365 ProPLus, build 1902). 

What I am missing? 

=================

Found out that it works but I was expecting different output. I wanted to get a group of symbols on the ribbon. 

Edited by Ostap
Link to post
Share on other sites

Does the _OL_OutlookBarAdd.au3 example script work for you?

If not, do you get an error message?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

You can't delete posts.

AFAIK you can modify the ribbon. But it is far more complex.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

@seadoggie01

I changed the function like this. You now always get an error message when the first recipient is empty. Be it from the first parameter being a string or an array.

; #FUNCTION# ====================================================================================================================
; Name ..........: _OL_ItemRecipientCheck
; Description ...: Checks one/more recipients to be valid.
; Syntax.........: _OL_ItemRecipientCheck($oOL, $vP1[, $sP2 = ""[, $sP3 = ""[, $sP4 = ""[, $sP5 = ""[, $sP6 = ""[, $sP7 = ""[, $sP8 = ""[, $sP9 = ""[, $vP10 = ""[, $bOnlyValid = False[, $bStrict = True]]]]]]]]]]])
; Parameters ....: $oOL        - Outlook object returned by a preceding call to _OL_Open()
;                  $vP1        - Name, Alias or SMTP mail address of one or multiple recipients separated by ";" ($sP2 to $vP10 are ignored if ";" is used)
;                  +or a zero based one-dimensional array with unlimited number of recipients
;                  $sP2        - Optional: Name, Alias or SMTP mail address of a single recipient (no concatenation of recipients using ";" allowed)
;                  $sP3        - Optional: Same as $sP2
;                  $sP4        - Optional: Same as $sP2
;                  $sP5        - Optional: Same as $sP2
;                  $sP6        - Optional: Same as $sP2
;                  $sP7        - Optional: Same as $sP2
;                  $sP8        - Optional: Same as $sP2
;                  $sP9        - Optional: Same as $sP2
;                  $vP10       - Optional: Same as $sP2
;                  $bOnlyValid - Optional: Only return the resolved recipient objects in a one-dimensional zero based array (default = False)
;                  $bStrict    - Optional: Does a strict and not just a left to right comparison. Please see Remarks (default = True)
; Return values .: Success - two-dimensional one based array with the following information (for $bOnlyValid = False):
;                  |0 - Recipient derived from the list of recipients in $vP1
;                  |1 - True if the recipient could be resolved successfully
;                  |2 - Recipient object as returned by the Resolve method
;                  |3 - AddressEntry object
;                  |4 - Recipients mail address (empty for distribution lists). This can be:
;                  |     PrimarySmtpAddress for an Exchange User
;                  |     Email1Address for an Outlook contact
;                  |     Empty for Exchange or Outlook distribution lists
;                  |5 - Display type is one of the OlDisplayType enumeration that describes the nature of the recipient
;                  |6 - Display name of the recipient
;                  Success - one-dimensional zero based array with the following information (for $bOnlyValid = True):
;                  |0 - Recipient object which was successfully resolved by the Resolve method. Unresolveable recipients are not part of the result!
;                  |     @extended holds the number of unresolved recipients.
;                  Failure - Returns "" and sets @error:
;                  |1 - $oOL is not an object
;                  |2 - $vP1 is empty or the first element of the array passed with $vP1 is empty
;                  |3 - Error creating recipient object. @extended contains the error returned by method CreateRecipient
; Author ........: water
; Modified ......:
; Remarks .......: When $bOnlyValid = True you get a one-dimensional zero based array with all invalid recipients removed.
;                  This array can easily be passed to _OL_ItemRecipientAdd.
;                  @extended holds the number of unresolved recipients.
;                  |
;                  Outlook compares the recipient from left to right with the address book. This means Outlook might find more than one recipient even when they
;                  are different e.g."John Doe" could be resolved to "John Doe" and "John Doerler".
;                  When $bStrict = True then the recipient is prependet with "=" so a strict comparison is used e.g. "=John Doe".
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _OL_ItemRecipientCheck($oOL, $vP1, $sP2 = "", $sP3 = "", $sP4 = "", $sP5 = "", $sP6 = "", $sP7 = "", $sP8 = "", $sP9 = "", $vP10 = "", $bOnlyValid = False, $bStrict = True)

    If $bOnlyValid = Default Then $bOnlyValid = False
    If $bStrict = Default Then $bStrict = True
    Local $oRecipient, $asRecipients[10], $iIndex2, $iUnresolved = 0
    If Not IsObj($oOL) Then Return SetError(1, 0, "")
    ; Move recipients into an array
    If Not IsArray($vP1) Then
        If StringInStr($vP1, ";") > 0 Then
            $asRecipients = StringSplit($vP1, ";", 2)
        Else
            $asRecipients[0] = $vP1
            $asRecipients[1] = $sP2
            $asRecipients[2] = $sP3
            $asRecipients[3] = $sP4
            $asRecipients[4] = $sP5
            $asRecipients[5] = $sP6
            $asRecipients[6] = $sP7
            $asRecipients[7] = $sP8
            $asRecipients[8] = $sP9
            $asRecipients[9] = $vP10
        EndIf
    Else
        $asRecipients = $vP1
    EndIf
    If StringStripWS($asRecipients[0], 3) = "" Then Return SetError(2, 0, "") ; <== Moved this line
    If $bOnlyValid Then
        Local $asResult[UBound($asRecipients, 1)]
        $iIndex2 = 0
    Else
        Local $asResult[UBound($asRecipients, 1) + 1][7] ; = [[UBound($asRecipients, 1), 7]]
        $iIndex2 = 1
    EndIf
    For $iIndex = 0 To UBound($asRecipients, 1) - 1
        If StringStripWS($asRecipients[$iIndex], 3) = "" Or $asRecipients[$iIndex] = Default Then ContinueLoop
        If Not $bOnlyValid Then $asResult[$iIndex2][0] = $asRecipients[$iIndex]
        If $bStrict And StringLeft($asRecipients[$iIndex], 1) <> "=" Then
            $oRecipient = $oOL.Session.CreateRecipient("=" & $asRecipients[$iIndex])
        Else
            $oRecipient = $oOL.Session.CreateRecipient($asRecipients[$iIndex])
        EndIf
        If @error Or Not IsObj($oRecipient) Then Return SetError(3, @error, "")
        $oRecipient.Resolve
        If @error Or Not $oRecipient.Resolved Then
            If $bOnlyValid Then
                $iUnresolved = $iUnresolved + 1 ; Count unresolved recipients
                ContinueLoop
            EndIf
            $asResult[$iIndex2][1] = False
        Else
            If $bOnlyValid Then
                $asResult[$iIndex2] = $oRecipient
            Else
                $asResult[$iIndex2][1] = True
                $asResult[$iIndex2][2] = $oRecipient
                Switch $oRecipient.AddressEntry.AddressEntryUserType
                    ; Exchange user that belongs to the same or a different Exchange forest
                    Case $olExchangeUserAddressEntry, $olExchangeRemoteUserAddressEntry
                        $asResult[$iIndex2][3] = $oRecipient.AddressEntry.GetExchangeUser
                        $asResult[$iIndex2][4] = $oRecipient.AddressEntry.GetExchangeUser.PrimarySmtpAddress
                        ; Address entry in an Outlook Contacts folder
                    Case $olOutlookContactAddressEntry
                        $asResult[$iIndex2][3] = $oRecipient.AddressEntry.GetContact
                        $asResult[$iIndex2][4] = $oRecipient.AddressEntry.GetContact.Email1Address
                        ; Address entry in an Exchange Distribution list
                    Case $olExchangeDistributionListAddressEntry
                        $asResult[$iIndex2][3] = $oRecipient.AddressEntry.GetExchangeDistributionList
                        ; Address entry in an an Outlook distribution list
                    Case $olOutlookDistributionListAddressEntry
                        $asResult[$iIndex2][3] = $oRecipient.AddressEntry
                    Case Else
                EndSwitch
                $asResult[$iIndex2][5] = $oRecipient.DisplayType
                $asResult[$iIndex2][6] = $oRecipient.Name
                If StringLeft($asResult[$iIndex2][6], 1) = "=" Then $asResult[$iIndex2][6] = StringMid($asResult[$iIndex2][6], 2)
            EndIf
        EndIf
        $iIndex2 = $iIndex2 + 1
    Next
    If $bOnlyValid Then
        ReDim $asResult[$iIndex2]
    Else
        ReDim $asResult[$iIndex2][7]
        $asResult[0][0] = $iIndex2 - 1
        $asResult[0][1] = 7
    EndIf
    Return SetError(0, $iUnresolved, $asResult)

EndFunc   ;==>_OL_ItemRecipientCheck

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Hello,

I can create an appointment item with start date/time and duration.

; Create an appointment and set some properties

$oItem = _OL_ItemCreate($oOL, $olAppointmentItem, "*\Kalender", "", "Subject=HomeOffice " & @UserName & ": " & GUICtrlRead($InputWhy), "Start=" & GUICtrlRead($MonthCal) & " " & GUICtrlRead($InputBeginHO), "Duration=480", "MeetingStatus=1")


This works perfect. But now I have to create an all day appointment item.

Can I create an all-day appointment item with OutlookEx-UDF? How do I do this? I searched the files OutlookEx.au3 and OutlookExConstants.au3, but I didn't find anything that would help me to do so.

Thanks in Advance,

Guido

I found the solution while trying the last time:

you have to add another parameter/value called AllDayEvent=1!!!
 

$oItem = _OL_ItemCreate($oOL, $olAppointmentItem, "*\Kalender", "", "Subject=HomeOffice " & @UserName & ": " & GUICtrlRead($InputGrund) & "/" & GUICtrlRead($InputBeginHO), "Start=" & GUICtrlRead($MonthCal) , "", "MeetingStatus=1", "AllDayEvent=1")

 

Edited by guidok
Found the solution
Link to post
Share on other sites
  • 2 weeks later...

I'm not sure how intended this is or how much is Outlook, but Recipient objects returned by _OL_ItemRecipientCheck have a leading equals sign in their names and email addresses. It looks strange when attempting to build a Distribution list :) 

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites

That‘s a bug. It has already been fixed but no new version of the UDF has been released since. 
I think I have posted the solution on the forum lately. 
Let me know if you can’t find it. I’m not at my computer right now. 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Can you please post an example so I can play with it?
I had a look at the UDF and think the bug has already been fixed in the latest version 1.4.0.0 🤔

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Sure... when $bFail is true, there will be an equals sign in the name of the recipient in the distribution list and in their email. (I removed error checking, but it ran for me)

Spoiler

 

#include <OutlookEX.au3>

OutlookTest()

Func OutlookTest()
    
    Local $bFails = True
    Local Const $sEmail = "<My Email>"

    ; Open Outlook
    Local $oOL = _OL_Open()

    ; Get the folder
    Local $aContactsFld = _OL_FolderAccess($oOL, "Public Folders - " & $sEmail & "\All Public Folders\<Longish Folder Name>\", $olFolderContacts)

    ; Create a Distribution list (contact group)
    Local $oDistGroup = _OL_ItemCreate($oOL, $olDistributionListItem, $aContactsFld[1], "")

    ; Add a name and category to it
    _OL_ItemModify($oOL, $oDistGroup, $aContactsFld[3], "DLName=test", "Categories=~ Contact Groups ~")

    ; Create a recipient to add to the new list
    Local $aRecipient = _OL_ItemRecipientCheck($oOL, $sEmail, Default, Default, Default, Default, Default, Default, Default, Default, Default, Default, $bFails)

    ; Add the recipeint to the list
    _OL_DistListMemberAdd($oOL, $oDistGroup, $aContactsFld[3], $aRecipient[1][2])

    ; Look at it
    $oDistGroup.Display()

    Sleep(10000)
    
    ; Delete it
    _OL_ItemDelete($oOL, $oDistGroup, $aContactsFld[3], True)

EndFunc

 

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites

I have removed all other lines from your script and only called _OL_ItemRecipientCheck for a SMTP address (john.doe@gmx.com) and my Exchange account (firstname lastname).

Can you please insert a _Arraydisplay($aRecipient) after _OL_ItemRecipientCheck in your script? Do you still see a leading equals sign?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

No, there is no leading equals sign there, which was what seemed strange to me... the recipient is resolved and everything looks good, but when I add the recipient to the distribution list, they are shown with a leading equals sign :D

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites

I have just run the _OL_DistListMemberAdd.au3 example script. No equal signs!
Could you please run the example script yourself?

You are sure to run the lastest version of the OutlookEX UDF?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

So that doesn't create the issue... but if you change example #2 to this it works the way I'm seeing it...

Global $sRecipient = InputBox("OutlookEX UDF: _OL_DistListMemberAdd Example Script","Please enter name of recipient to be added to the distribution list")
Global $oOL_Recipient = _OL_ItemRecipientCheck($oOutlook, $sRecipient, Default, Default, Default, Default, Default, Default, Default, Default, Default, Default, True)[1][2] ;<-- Get the recipient object (assumes it works)
$oItem = _OL_DistListMemberAdd($oOutlook, $aOL_Item[1][0], Default, $oOL_Recipient)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_DistListMemberAdd Example Script", "Error adding member to distribution list in folder 'Outlook-UDF-Test\SourceFolder\Contacts'. @error = " & @error & ", @extended = " & @extended)
; Display item
$oItem.Display
MsgBox(64, "OutlookEX UDF: _OL_DistListMemberAdd Example Script", "Member successfully added to distribution list!")

_OL_Close($oOutlook)

It appears to have something to do with _OL_ItemRecipientCheck combined with _OL_DistListMemberAdd

Edit: I forgot, yes, the Outlook version I have is 1.4.0.0... the modified date says July 24, 2019 however. I'll redownload it just to be sure.

Edit 2: Yup, still modified in July. I have the latest version

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites

Will check as soon as I return to my office :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

I was able to reproduce the problem when I add a SMTP address (e.g. john.doe@gmx.com) to the distribution list. Exchange addresses (e.g. "John Doe") work fine.

Will investigate what causes the problem!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Solution is to not do a strict check for SMTP addresses (doesn't make sense anyway). So please replace the following line in function _OL_RecipientCheck:

If $bStrict And StringLeft($asRecipients[$iIndex], 1) <> "=" Then

with

If $bStrict And StringLeft($asRecipients[$iIndex], 1) <> "=" And StringInStr($asRecipients[$iIndex], "@") = 0 Then ; $bStrict is ignored for SMTP-addresses

If it works for you I will add this to the next release of the UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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 (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Yes, that works for me :)

I also discovered a bug in _OL_ItemRecipientDelete... kinda... basically it goes like this:

Step 1: Use _OL_ItemRecipientGet to retrieve the recipients of an email

Step 2: Loop through and determine which ones to remove, collecting their index (1, 3, 5, 7, 9)

Step 3: Pass these to _OL_ItemRecipientDelete, which will delete items (1, 4, 7, 10, 13) which is (1+0, 3+1, 5+2, 7+3, 9+4)

This happens because Outlook recalculates the position of each recipient after a recipient is deleted... to fix it you could do something like this:

;<-- Snipped _OL_ItemRecipientDelete initial setup -->
; Delete recipients from the item
For $iIndex = 0 To UBound($aRecipients) - 1
    If StringStripWS($aRecipients[$iIndex], 3) = "" Or $aRecipients[$iIndex] = Default Then ContinueLoop
    ; Below line subtracts index to correctly re-calculate position after removal
    $vItem.Recipients.Remove($aRecipients[$iIndex] - $iIndex)
    If @error Then Return SetError(3, $iIndex, 0)
Next
$vItem.Save()
Return $vItem

EndFunc ;==>_OL_ItemRecipientDelete

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Cyborg5000
      Can some one please point me why i keep getting the error while the script is in loop:-
      "C:\Program Files (x86)\AutoIt3\Include\OutlookEX.au3" (2443) : ==> Subscript used on non-accessible variable.:
      If Not (IsNumber($iAttachment)) Or $iAttachment < 1 Or $iAttachment > $aAttachments[0][0] Then Return SetError(8, $aAttachments[0][0], 0)
      If Not (IsNumber($iAttachment)) Or $iAttachment < 1 Or $iAttachment > $aAttachments^ ERROR
      My code as below though copied and modified as per need, to get attachments, and other details.
      #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <IE.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <StringConstants.au3> #include <FileConstants.au3> #include <Array.au3> #include <String.au3> #include <UIAWrappers.au3> #include <GuiEdit.au3> #include <Clipboard.au3> #include <WinAPI.au3> #include <ColorConstants.au3> #include <FontConstants.au3> #include <ProgressConstants.au3> #include <Restart.au3> #include <_IEquerySelectorAll.au3> #include <GuiRichEdit.au3> #include <hiddenDesktopInteract.au3> #include <Date.au3> #include <CUIAutomation2.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <OutlookEX.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> ;Global $oErrorHandler = ObjEvent("Autoit.Error", "ComErrorHandler") FileDelete("D:\attachment\*.*") FileDelete("D:\Email-Details\*.*") FileDelete("D:\Script-temp\*.*") FileDelete("D:\Downloaded-Cert\*.*") FileDelete("D:\LOG\*.*") RunWait("taskkill /F /IM iexplore.exe /T", "", @SW_HIDE) ;Global $Errorcomments ;If Not IsDeclared($Errorcomments) Then Global $Errorcomments ; ***************************************************************************** ; Example Script ; Handle Outlook NewmailEX event when a new mail arrives. ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script ;MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") While 1     Sleep(400) WEnd FileDelete("D:\attachment\*.*") FileDelete("D:\Email-Details\*.*") FileDelete("D:\Script-temp\*.*") FileDelete("D:\Downloaded-Cert\*.*") FileDelete("D:\LOG\*.*") RunWait("taskkill /F /IM iexplore.exe /T", "", @SW_HIDE) ; Outlook 2007 - NewMailEx event - http://msdn.microsoft.com/en-us/library/bb147646%28v=office.12%29.aspx Func oOApp_NewMailEx($sOL_EntryId)     FileDelete("D:\attachment\*.*")     FileDelete("D:\Email-Details\*.*")     FileDelete("D:\Script-temp\*.*")     FileDelete("D:\Downloaded-Cert\*.*")     FileDelete("D:\LOG\*.*")     RunWait("taskkill /F /IM iexplore.exe /T", "", @SW_HIDE)     Sleep(1000)     Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)     Sleep(1000)     _OL_ItemAttachmentSave($oOApp, $oOL_Item, Default, 1, "D:\attachment\")     Sleep(1000)     ;MsgBox(64, "OutlookEX UDF Example Script", "New mail has arrived!" & @CRLF & @CRLF & _     ;"From:    " & $oOL_Item.SenderName & @CRLF & _     ;"Subject: " & $oOL_Item.Subject)     Local $oOL_Item1 = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)     Sleep(1000)     Local $oOL_Sender = $oOL_Item1.Sender     If $oOL_Sender.AddressEntryUserType = $olExchangeUserAddressEntry Or $oOL_Sender.AddressEntryUserType = $olExchangeRemoteUserAddressEntry Then         Local $oExchangeUser = $oOL_Sender.GetExchangeUser     Else         Sleep(2000)     EndIf     Sleep(1000)     Local $sendername = ("D:\Email-Details\sendername.txt")     Local $Subject = ("D:\Email-Details\subject.txt")     ;=================================Subjectfile file write ===========================================     Local $Subject1 = FileOpen($Subject, $FO_APPEND)     If $Subject1 = -1 Then         MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the Subject file.")         Return False     EndIf     ; Write data to the file using the handle returned by FileOpen.     FileWrite($Subject1, $oOL_Item1.Subject)     ; Close the handle returned by FileOpen.     FileClose($Subject1)     Sleep(1000) ;=================================End sendername file write ===========================================     $Filerunpath = ("C:\Users\certauto\Desktop\Test.Exe")     Local $iPID = Run($Filerunpath)     ProcessWaitClose($iPID)     Sleep(1000)     _OL_ItemModify($oOApp, $oOL_Item, Default, "Unread=False")     ;$openemail = WinActivate ( "[CLASS:NetUIHWND; INSTANCE:1]", "" )     ;ControlClick($openemail, "", "NUIDialog")     ;$oOApp.Session.Logoff     Sleep(1000)     ;====================Mark email as read===========================================     ;_OL_ItemModify($oOL_Item,$oOApp.Session.GetItemFromID($sOL_EntryId, Default, "Unread=False")     Sleep(1000) EndFunc   ;==>oOApp_NewMailEx Func _Exit()     Exit EndFunc   ;==>_Exit
    • By Skysnake
      This assumes implementation of the OutlookEX UDF.
      I have PSTs which are becoming unmanageable 
      The idea is to make a simple GUI (Listview) which can combine non-Outlook data and include emails based on criteria.  Manage them in the GUI (delete / reply etc) and update to Outlook.
      So the issue would be to manage the items in the GUI while using the PST as a database.
      Ideas on how to do this? What would the key be?
    • By Reizvoller
      Howdy!
      I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) 
      https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General
       
      But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this 
      ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. 
      I really hope I didn't overlook a wiki page or help file... 
      Any assistance would be greatly appreciated!
      -Reiz
    • By galan2015
      Is there any solution on receiving e-mails? I would like to create a script so that I will not have to log in through the browser.
×
×
  • Create New...